diff options
author | Camil Staps | 2021-06-13 13:56:45 +0200 |
---|---|---|
committer | Camil Staps | 2021-06-13 13:56:45 +0200 |
commit | 7c2ea00eae7c273bb26181d2fa438076c3ac8446 (patch) | |
tree | 58d3fa86d615fa20e869101e638c86e10c71f79c /vim/.vimrc | |
parent | Fix vimrc; redefine functions and commands in case the file is resourced (diff) |
Setup neovim lsp
Diffstat (limited to 'vim/.vimrc')
-rw-r--r-- | vim/.vimrc | 35 |
1 files changed, 31 insertions, 4 deletions
@@ -34,6 +34,10 @@ Plugin 'google/vim-searchindex' " shows '[N/M]' when searching " Color schemes Plugin 'NLKNguyen/papercolor-theme' +if has('nvim') + Plugin 'neovim/nvim-lspconfig' " Language Server Protocol configs +endif + call vundle#end() " End Vundle @@ -80,6 +84,7 @@ highlight SpellBad cterm=underline,bold ctermfg=black ctermbg=red highlight SpellCap cterm=underline,bold ctermfg=black ctermbg=yellow highlight SpellLocal cterm=underline,bold ctermfg=black ctermbg=blue highlight SpellRare cterm=underline,bold ctermfg=black ctermbg=white + highlight ColorColumn ctermfg=black ctermbg=yellow " The terminal background (set in .Xresources) is the background for that part @@ -109,7 +114,26 @@ function! s:detect_terminal_line_border() call s:set_terminal_line_border('1c1c1c') endif endfunction -autocmd VimEnter,ColorScheme * call s:detect_terminal_line_border() + +function! s:colorscheme_changed() + call s:detect_terminal_line_border() + + if has('nvim') + " See https://github.com/neovim/nvim-lspconfig/issues/516 + lua require('vim.lsp.diagnostic')._define_default_signs_and_highlights() + + highlight LspDiagnosticsDefaultError ctermfg=red + highlight LspDiagnosticsSignError ctermfg=red + highlight LspDiagnosticsDefaultWarning ctermfg=brown + highlight LspDiagnosticsSignWarning ctermfg=brown + highlight LspDiagnosticsDefaultInformation ctermfg=yellow + highlight LspDiagnosticsSignInformation ctermfg=yellow + highlight LspDiagnosticsDefaultHint ctermfg=yellow + highlight LspDiagnosticsSignHint ctermfg=yellow + endif +endfunction + +autocmd VimEnter,ColorScheme * call s:colorscheme_changed() " When we leave vim we restore the value set also in .Xresources autocmd VimLeave * call s:set_terminal_line_border('002b36') @@ -125,8 +149,8 @@ map <LocalLeader>s :syn sync fromstart<CR> function! s:enable_automatic_background() augroup bg - autocmd bg BufEnter * set bg=dark | call s:detect_terminal_line_border() - autocmd bg BufEnter *.bib,*.md,*.tex,*.txt set bg=light | call s:detect_terminal_line_border() + autocmd bg BufEnter * set background=dark | call s:colorscheme_changed() + autocmd bg BufEnter *.bib,*.md,*.tex,*.txt set background=light | call s:colorscheme_changed() augroup END endfunction @@ -160,7 +184,10 @@ let g:VM_case_setting = 'sensitive' " Don't let match-up mess up the statusline let g:matchup_matchparen_status_offscreen=0 -" Clean +" Status line based on LSP +set statusline+=%{luaeval('lsp_first_hover_code()')} + +" Clean has no language server, we use the cloogletags statusline component set statusline+=%{cleanvim#tags#statusline()} " Git gutter |