From 9e8120163c96544b52380e76c2a8d89c4f3fa381 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Thu, 7 Mar 2019 22:33:21 +0100 Subject: Revert back to basic ctags navigation LSP based navigation in a header-centric codebase turned out to be not that much better than plain ctags. The latter has the advantage of being both the most performant and most simple to setup. The main problem with e.g. cquery is that its underlying JSON compilation database only maintains information on compilation units i.e. cpp files. In this situation navigation in header files frequently reverts back to plain guessing which provides no advantage over ctags. Added vim-gutentags for automatic regeneration on file save. --- pkgs/custom-neovim/asset/rc.vim | 46 +++-------------------------------------- pkgs/custom-neovim/default.nix | 2 +- pkgs/custom-neovim/plugins.nix | 18 ---------------- 3 files changed, 4 insertions(+), 62 deletions(-) diff --git a/pkgs/custom-neovim/asset/rc.vim b/pkgs/custom-neovim/asset/rc.vim index 31eb27a..6675cce 100644 --- a/pkgs/custom-neovim/asset/rc.vim +++ b/pkgs/custom-neovim/asset/rc.vim @@ -36,8 +36,8 @@ let mapleader="," map s :let @/="" map c zz -map d map h q: +map d g nmap :e# nmap f za @@ -123,45 +123,5 @@ let g:undotree_SetFocusWhenToggle = 1 let g:localvimrc_sandbox = 0 let g:localvimrc_persistent = 2 -let g:wordmotion_prefix = '' -nmap w - -let g:lsp_auto_enable = 0 - -" spinning up a language client only makes -" sense if such a client is available -if executable('cquery') - let g:lsp_auto_enable = 1 - - autocmd User lsp_setup call lsp#register_server({ - \ 'name': 'cquery', - \ 'cmd': {server_info->['cquery']}, - \ 'root_uri': {server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'compile_commands.json'))}, - \ 'initialization_options': { 'cacheDirectory': '/tmp/cquery' }, - \ 'whitelist': ['c', 'cpp', 'cc'], - \ }) - - nnoremap gd :LspDefinition - nnoremap gt :LspTypeDefinition - nnoremap gi :LspImplementation - nnoremap gr :LspReferences - nnoremap :LspWorkspaceSymbol - nnoremap :LspDocumentSymbol - - autocmd FileType cpp setlocal omnifunc=lsp#complete - set completeopt=longest,menuone,preview - " use enter to select completion item - inoremap pumvisible() ? "\" : "\u\" - " improve popup and selection behavior - inoremap pumvisible() ? '' : - \ '=pumvisible() ? "\Down>" : ""' - inoremap pumvisible() ? '' : - \ '=pumvisible() ? "\Down>" : ""' - " trigger omnicompletion using (compared to for plain completion) - inoremap - - " close documentation buffer after selecting a completion item - autocmd CompleteDone * silent! pclose - " close quickfix buffer after selection - autocmd FileType qf nnoremap :cclose -endif +let g:wordmotion_prefix = '' +nmap w diff --git a/pkgs/custom-neovim/default.nix b/pkgs/custom-neovim/default.nix index 1dff1f7..422847e 100644 --- a/pkgs/custom-neovim/default.nix +++ b/pkgs/custom-neovim/default.nix @@ -17,7 +17,7 @@ in pkgs.neovim.override { # autocomplete fzfWrapper fzf-vim - async vim-lsp + vim-gutentags # load project specific config vim-localvimrc diff --git a/pkgs/custom-neovim/plugins.nix b/pkgs/custom-neovim/plugins.nix index 5e0f6ea..9ff92f2 100644 --- a/pkgs/custom-neovim/plugins.nix +++ b/pkgs/custom-neovim/plugins.nix @@ -76,24 +76,6 @@ in { }; }; - vim-lsp = buildVimPlugin { - name = "vim-lsp"; - src = fetchgit { - url = "https://github.com/prabirshrestha/vim-lsp.git"; - rev = "0310241af11adc6c3a7ba93955bc27b15744c957"; - sha256 = "0ccd6is75qlk8mg9wpwp1ypq68p7lgbq1c1jbpr6pwr59s53r4lx"; - }; - }; - - async = buildVimPlugin { - name = "async"; - src = fetchgit { - url = "https://github.com/prabirshrestha/async.vim.git"; - rev = "f3014550d7a799097e56b094104dd2cd66cf2612"; - sha256 = "0zn25qwycynagrij5rsp1x7kbfz612gn7xda0hvm4y7qr3pal77p"; - }; - }; - vim-color-akr = buildVimPlugin { name = "vim-color-akr"; src = ./asset/vim-color-akr; -- cgit v1.2.3