diff --git a/.vimrc b/.vimrc index 4320a55..6243886 100644 --- a/.vimrc +++ b/.vimrc @@ -51,6 +51,8 @@ set splitbelow " bash). "set completeopt=menu,menuone,longest set completeopt=noinsert,menuone,noselect,longest +set signcolumn=yes +set shortmess+=c set diffopt+=vertical " Some stuff for 256-Color consoles that I've forgotten. @@ -195,7 +197,11 @@ Plug 'zchee/vim-goasm' "\ 'do': 'bash install.sh', "\ } "Plug 'ensime/ensime-vim', { 'do': ':UpdateRemotePlugins' } -Plug 'neoclide/coc.nvim', {'branch': 'release'} +"Plug 'neoclide/coc.nvim', {'branch': 'release'} +Plug 'neovim/nvim-lspconfig' +Plug 'nvim-lua/lsp_extensions.nvim' +Plug 'nvim-lua/completion-nvim' +Plug 'onsails/lspkind-nvim' " Plugins that do specific things Plug 'Shougo/vimproc.vim' @@ -217,42 +223,151 @@ Plug 'barakmich/vim-code-dark' call plug#end() +filetype plugin indent on +syntax enable + " enable ncm2 for all buffers "autocmd BufEnter * call ncm2#enable_for_buffer() -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) -imap , (coc-snippets-expand) -imap ff (coc-fix-current) -nmap ff (coc-fix-current) -" Use K to show documentation in preview window -nnoremap K :call show_documentation() +" **** CoC bindings +"nmap gd (coc-definition) +"nmap gy (coc-type-definition) +"nmap gi (coc-implementation) +"nmap gr (coc-references) +"imap l (coc-codeaction) +"imap , (coc-snippets-expand) +"imap ff (coc-fix-current) +"nmap ff (coc-fix-current) +"" Use `[g` and `]g` to navigate diagnostics +"" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. +"nmap [g (coc-diagnostic-prev) +"nmap ]g (coc-diagnostic-next) -function! s:show_documentation() - if (index(['vim','help'], &filetype) >= 0) - execute 'h '.expand('') - else - call CocAction('doHover') - endif -endfunction +"" Use K to show documentation in preview window +"nnoremap K :call show_documentation() + +"function! s:show_documentation() + "if (index(['vim','help'], &filetype) >= 0) + "execute 'h '.expand('') + "else + "call CocAction('doHover') + "endif +"endfunction -"NeoBundle 'eclim' -"https://git.wincent.com/command-t.git -filetype plugin indent on " required -syntax enable -"filetype plugin indent on " If you prefer the Omni-Completion tip window to close when a selection is " made, these lines close it on movement in insert mode or when leaving " insert mode "autocmd CursorMovedI * if pumvisible() == 0|pclose|endif "autocmd InsertLeave * if pumvisible() == 0|pclose|endif -inoremap pumvisible() ? coc#_select_confirm() : "\u\" +" inoremap pumvisible() ? coc#_select_confirm() : "\u\" -" Sources +" **** End CoC + +" **** Configure LSP +lua < and to navigate through popup menu +inoremap pumvisible() ? "\" : "\" +inoremap pumvisible() ? "\" : "\" + +" use as trigger keys +imap (completion_smart_tab) +imap (completion_smart_s_tab) + +" Code navigation shortcuts +nnoremap gd lua vim.lsp.buf.definition() +nnoremap gi lua vim.lsp.buf.implementation() +nnoremap gy lua vim.lsp.buf.type_definition() +nnoremap K lua vim.lsp.buf.hover() +nnoremap gK lua vim.lsp.buf.signature_help() +nnoremap gr lua vim.lsp.buf.references() +nnoremap g0 lua vim.lsp.buf.document_symbol() +nnoremap gW lua vim.lsp.buf.workspace_symbol() +"nnoremap gd lua vim.lsp.buf.declaration() +nnoremap ga lua vim.lsp.buf.code_action() +nnoremap ge lua vim.lsp.diagnostic.show_line_diagnostics() + +" Set updatetime for CursorHold +" 300ms of no cursor movement to trigger CursorHold +set updatetime=500 +" Show diagnostic popup on cursor hold +autocmd CursorHold * lua vim.lsp.diagnostic.show_line_diagnostics() + +" Goto previous/next diagnostic warning/error +nnoremap g[ lua vim.lsp.diagnostic.goto_prev() +nnoremap g] lua vim.lsp.diagnostic.goto_next() + +let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy', 'all'] +let g:completion_matching_smart_case = 1 + + +" **** End LSP + +"" Sources "source ~/.vim/supertab.vim "source ~/.vim/charm.vim "source ~/.vim/plugin/AppleT.vim @@ -386,11 +501,12 @@ let g:NERDTreeMarkBookmarks = 0 let g:NERDTreeMinimalUI = 1 " * Signify -let g:signify_realtime = 0 +let g:signify_realtime = 1 let g:signify_vcs_list = ['git'] let g:signify_sign_change = '~' let g:signify_sign_changedelete = g:signify_sign_change let g:signify_sign_show_count = 0 +let g:signify_priority = 5 " * VimFiler let g:vimfiler_tree_indentation = 2 @@ -745,7 +861,7 @@ nmap gb :TagbarToggle " gK is similar. nnoremap gc :Kwbd "nnoremap gc :bdelete -nnoremap gK :bdelete! +"nnoremap gK :bdelete! " I use gn/gp to cycle through open tabs/buffers nnoremap gn :bn