summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-03-05 16:21:47 +0100
committerAdrian Kummerlaender2019-03-05 16:21:47 +0100
commitb6544120a820700785ef0d05b462df2e4bb17c53 (patch)
treef3942485f4771b28eabcc4d94ef214d0047b0f89
parent39e5cba8ad350c1ecee66ee18093f20146a60bba (diff)
downloadpkgs-b6544120a820700785ef0d05b462df2e4bb17c53.tar
pkgs-b6544120a820700785ef0d05b462df2e4bb17c53.tar.gz
pkgs-b6544120a820700785ef0d05b462df2e4bb17c53.tar.bz2
pkgs-b6544120a820700785ef0d05b462df2e4bb17c53.tar.xz
pkgs-b6544120a820700785ef0d05b462df2e4bb17c53.zip
Test simpler setup using vim-lsp
Feels less distracting and faster. I don't actually want to turn this vim setup into a always active intellisense-like experience but rather have code introspection quickly available if I actually need it.
-rw-r--r--pkgs/custom-neovim/asset/rc.vim40
-rw-r--r--pkgs/custom-neovim/default.nix4
-rw-r--r--pkgs/custom-neovim/plugins.nix18
3 files changed, 41 insertions, 21 deletions
diff --git a/pkgs/custom-neovim/asset/rc.vim b/pkgs/custom-neovim/asset/rc.vim
index 822ac87..202b1ad 100644
--- a/pkgs/custom-neovim/asset/rc.vim
+++ b/pkgs/custom-neovim/asset/rc.vim
@@ -126,25 +126,29 @@ let g:localvimrc_persistent = 2
let g:wordmotion_prefix = '<Leader>'
nmap <S-w> <Leader>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:LanguageClient_serverCommands = { 'cpp': [ 'cquery' ] }
- let g:LanguageClient_hoverPreview = "Never"
-
- set completefunc=LanguageClient#complete
- set completeopt-=preview
-
- inoremap <C-n> <C-x><C-o>
- " allow completion selection via CR without inserting a new line
- imap <expr><CR> pumvisible() ? "\<C-y>" : "\<CR>"
-
- noremap <leader>lc :call LanguageClient_contextMenu()<CR>
- noremap <leader>lr :call LanguageClient_rename()<CR>
- nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
- nnoremap <silent> gt :call LanguageClient#textDocument_typeDefinition()<CR>
- nnoremap <silent> gi :call LanguageClient#textDocument_implementation()<CR>
-
- nmap <c-t> :Denite workspaceSymbol<CR>
- nmap <a-t> :Denite documentSymbol<CR>
+ 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 <silent> gd :LspDefinition<CR>
+ nnoremap <silent> gt :LspTypeDefinition<CR>
+ nnoremap <silent> gi :LspImplementation<CR>
+ nnoremap <silent> gr :LspReferences<CR>
+
+ nmap <c-t> :LspWorkspaceSymbol<CR>
+ nmap <a-t> :LspDocumentSymbol<CR>
+
+ autocmd FileType cpp setlocal omnifunc=lsp#complete
+ inoremap <C-m> <C-x><C-o>
endif
diff --git a/pkgs/custom-neovim/default.nix b/pkgs/custom-neovim/default.nix
index ca1fc75..1dff1f7 100644
--- a/pkgs/custom-neovim/default.nix
+++ b/pkgs/custom-neovim/default.nix
@@ -17,9 +17,7 @@ in pkgs.neovim.override {
# autocomplete
fzfWrapper
fzf-vim
- LanguageClient-neovim
- deoplete-nvim
- denite
+ async vim-lsp
# load project specific config
vim-localvimrc
diff --git a/pkgs/custom-neovim/plugins.nix b/pkgs/custom-neovim/plugins.nix
index 9ff92f2..5e0f6ea 100644
--- a/pkgs/custom-neovim/plugins.nix
+++ b/pkgs/custom-neovim/plugins.nix
@@ -76,6 +76,24 @@ 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;