nvim: Configure nvim-completion & remove conflicting LSP bindings

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
Sanchayan Maity 2020-05-25 17:50:09 +05:30
parent 901c4cd1fd
commit 2ad7100749
3 changed files with 45 additions and 6 deletions

View file

@ -1,9 +1,9 @@
nnoremap <silent> gd <cmd>lua vim.lsp.buf.declaration()<CR>
nnoremap <silent> <c-]> <cmd>lua vim.lsp.buf.definition()<CR>
nnoremap <silent> K <cmd>lua vim.lsp.buf.hover()<CR>
nnoremap <silent> gD <cmd>lua vim.lsp.buf.implementation()<CR>
nnoremap <silent> <c-k> <cmd>lua vim.lsp.buf.signature_help()<CR>
nnoremap <silent> 1gD <cmd>lua vim.lsp.buf.type_definition()<CR>
nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>
nnoremap <silent> gk <cmd>lua vim.lsp.buf.hover()<CR>
nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>
nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>
nnoremap <silent> gs <cmd>lua vim.lsp.buf.signature_help()<CR>
nnoremap <silent> gt <cmd>lua vim.lsp.buf.type_definition()<CR>
nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>
nnoremap <silent> g0 <cmd>lua vim.lsp.buf.document_symbol()<CR>
nnoremap <silent> gW <cmd>lua vim.lsp.buf.workspace_symbol()<CR>

View file

@ -163,6 +163,11 @@ nnoremap <BS> <C-^>
" Map to ; to : for easy access to command mode. Behaviour of ; can be taken
" care of by f due to clever-f
nnoremap ; :
" For nvim-completion
imap <C-j> <cmd>lua require'source'.prevCompletion()<CR>
imap <C-k> <cmd>lua require'source'.nextCompletion()<CR>
" Asynchronous make
command! -bang -nargs=* -complete=file Make call asyncdo#run(<bang>0, &makeprg, <f-args>)
command! -bang -nargs=* -complete=file LMake call asyncdo#lrun(<bang>0, &makeprg, <f-args>)

View file

@ -68,5 +68,39 @@ let g:diagnostic_show_sign = 1
let g:diagnostic_auto_popup_while_jump = 1
let g:diagnostic_insert_delay = 1
" For nvim-completion
let g:completion_enable_auto_popup = 1
let g:completion_auto_change_source = 1
let g:completion_chain_complete_list = {
\ 'c': [
\ {'mode': 'keyn'},
\ {'mode': 'tags'},
\ {'mode': '<c-p>'},
\ {'mode': '<c-n>'}
\],
\ 'haskell': [
\ {'mode': 'keyn'},
\ {'mode': 'tags'},
\ {'mode': '<c-p>'},
\ {'mode': '<c-n>'},
\ {'mode': 'omni'}
\],
\ 'rust': [
\ {'complete_items': ['lsp']},
\ {'mode': 'keyn'}
\],
\ 'purescript': [
\ {'mode': 'keyn'},
\ {'mode': 'omni'},
\ {'mode': '<c-p>'},
\ {'mode': '<c-n>'}
\],
\ 'default': [
\ {'mode': 'keyn'},
\ {'mode': '<c-p>'},
\ {'mode': '<c-n>'},
\],
\}
lua require'nvim_lsp'.rust_analyzer.setup{}
lua require'nvim_lsp'.rust_analyzer.setup{on_attach=require'diagnostic'.on_attach}