nvim: Refactor and update settings for completion-nvim

Use of trigger keys has been updated upstream. Also disable auto
completion.
This commit is contained in:
Sanchayan Maity 2020-10-13 10:19:14 +05:30
parent b3af70ced1
commit 18b93f32d7
3 changed files with 46 additions and 52 deletions

View file

@ -1,14 +1,49 @@
" For nvim-completion
let g:completion_enable_auto_popup = 0
let g:completion_auto_change_source = 1
let g:completion_trigger_on_delete = 1
let g:completion_matching_ignore_case = 0
let g:completion_matching_strategy_list = ['exact', 'substring']
let g:completion_chain_complete_list = {
\ 'c': [
\ {'complete_items': ['buffers']},
\ {'mode': 'tags'},
\ {'mode': 'keyn'},
\ {'mode': '<c-p>'},
\ {'mode': '<c-n>'}
\],
\ 'haskell': [
\ {'complete_items': ['lsp']},
\ {'complete_items': ['buffers']},
\ {'mode': 'keyn'},
\ {'mode': '<c-p>'},
\ {'mode': '<c-n>'},
\],
\ 'rust': [
\ {'complete_items': ['lsp']},
\ {'complete_items': ['buffers']},
\ {'mode': 'keyn'}
\],
\ 'purescript': [
\ {'complete_items': ['lsp']},
\ {'complete_items': ['buffers']},
\ {'mode': 'keyn'},
\ {'mode': '<c-p>'},
\ {'mode': '<c-n>'}
\],
\ 'default': [
\ {'complete_items': ['buffers']},
\ {'mode': 'keyn'},
\ {'mode': '<c-p>'},
\ {'mode': '<c-n>'},
\],
\}
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
imap <Tab> <Plug>(completion_smart_tab)
imap <C-j> <Plug>(completion_next_source)
imap <C-k> <Plug>(completion_prev_source)
" Tab completion. Taken from nvim-completion README.
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ completion#trigger_completion()
" Use completion-nvim in every buffer
autocmd BufEnter * lua require'completion'.on_attach()

View file

@ -28,9 +28,6 @@ augroup UserStatusline
autocmd ColorScheme * hi User8 guifg=DarkYellow guibg=Black
augroup END
" Use completion-nvim in every buffer
autocmd BufEnter * lua require'completion'.on_attach()
augroup LuaHighlight
autocmd!
autocmd TextYankPost * silent! lua require'vim.highlight'.on_yank("IncSearch", 2000)

View file

@ -56,43 +56,5 @@ 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': [
\ {'complete_items': ['buffers']},
\ {'mode': 'keyn'},
\ {'mode': 'tags'},
\ {'mode': '<c-p>'},
\ {'mode': '<c-n>'}
\],
\ 'haskell': [
\ {'complete_items': ['lsp']},
\ {'complete_items': ['buffers']},
\ {'mode': 'keyn'},
\ {'mode': '<c-p>'},
\ {'mode': '<c-n>'},
\],
\ 'rust': [
\ {'complete_items': ['lsp']},
\ {'complete_items': ['buffers']},
\ {'mode': 'keyn'}
\],
\ 'purescript': [
\ {'complete_items': ['lsp']},
\ {'complete_items': ['buffers']},
\ {'mode': 'keyn'},
\ {'mode': '<c-p>'},
\ {'mode': '<c-n>'}
\],
\ 'default': [
\ {'complete_items': ['buffers']},
\ {'mode': 'keyn'},
\ {'mode': '<c-p>'},
\ {'mode': '<c-n>'},
\],
\}
lua require 'lsp'
lua require 'treesitter'