From cd52e47e22d54ab351346c3db147456c732340c9 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Thu, 8 Oct 2020 10:34:45 +0200 Subject: [PATCH] nvim: Add workaround for completion-nvim bug completion-nvim chaining seems to not allow multiple `triggered_only` definitions in the same linked chain of various completion options. In other words, when in pandoc files there is no possibility to have completion for lsp and buffer words by default and for paths on pressing `/`, as well as bib-citekeys on pressing `@`. Doing so requires automatically switching sources, which in turn is of little use when writing pandoc normally and it hangs every couple of seconds to recompile the bibtex list as soon as it runs out of buffer words to complete. Ideally, the completion-nvim bug should be looked at, but also the bibtex completion possibly completely turned into a lua parsed completer, so it does not depend on `vim-pandoc` and its (presumably) slower vimscript implementation. --- nvim/.config/nvim/plugin/completion-nvim.vim | 44 +++++++++++--------- nvim/.config/nvim/plugin/nvim-lspconfig.vim | 19 +++++---- nvim/.config/nvim/spell/en.utf-8.add | 2 + 3 files changed, 37 insertions(+), 28 deletions(-) diff --git a/nvim/.config/nvim/plugin/completion-nvim.vim b/nvim/.config/nvim/plugin/completion-nvim.vim index 201a0f4..9860e1f 100644 --- a/nvim/.config/nvim/plugin/completion-nvim.vim +++ b/nvim/.config/nvim/plugin/completion-nvim.vim @@ -7,7 +7,7 @@ imap (completion_smart_s_tab) " switch between completion sources manually with c-j/c-k " only do so if popupmenu is visible, otherwise normal function imap (completion_next_source) -imap (completion_previous_source) +imap (completion_prev_source) " Set completeopt to have a better completion experience set completeopt=menuone,noinsert,noselect @@ -47,23 +47,27 @@ endfun " the completion chains for different filetypes " see https://github.com/nvim-lua/completion-nvim/wiki/chain-complete-support +" BUG for triggered only bibcite completion, see: https://github.com/nvim-lua/completion-nvim/issues/158 let g:completion_chain_complete_list = { - \ 'pandoc': [ - \ { 'complete_items': ['buffer', 'lsp', 'snippet']}, - \ { 'complete_items': ['bibcite'] }, - \ { 'mode': ''}, - \ { 'mode': ''} - \], - \ 'tex': [ - \ { 'complete_items': ['buffer', 'lsp', 'snippet']}, - \ { 'complete_items': ['bibcite'] }, - \ { 'mode': ''}, - \ { 'mode': ''} - \], - \ 'default': [ - \ { 'complete_items': ['lsp', 'snippet']}, - \ { 'complete_items': [ 'buffers' ] }, - \ { 'mode': ''}, - \ { 'mode': ''} - \] -\} + \ 'pandoc': [ + \ { 'complete_items': ['buffer', 'lsp', 'snippet']}, + \ { 'complete_items': ['path'], 'triggered_only': ['/']}, + \ { 'complete_items': ['bibcite']}, + \ { 'mode': ''}, + \ { 'mode': ''} + \], + \ 'tex': [ + \ { 'complete_items': ['buffer', 'lsp', 'snippet']}, + \ { 'complete_items': ['path'], 'triggered_only': ['/']}, + \ { 'complete_items': ['bibcite'] }, + \ { 'mode': ''}, + \ { 'mode': ''} + \], + \ 'default': [ + \ { 'complete_items': [ 'lsp', 'snippet' ]}, + \ { 'complete_items': [ 'buffers' ] }, + \ { 'complete_items': [ 'path' ], 'triggered_only': ['/'] }, + \ { 'mode': ''}, + \ { 'mode': ''} + \] + \} diff --git a/nvim/.config/nvim/plugin/nvim-lspconfig.vim b/nvim/.config/nvim/plugin/nvim-lspconfig.vim index 128e0d4..ef1c23b 100644 --- a/nvim/.config/nvim/plugin/nvim-lspconfig.vim +++ b/nvim/.config/nvim/plugin/nvim-lspconfig.vim @@ -1,9 +1,12 @@ -" enable python language servers -lua require'nvim_lsp'.pyls.setup{} -lua require'nvim_lsp'.vimls.setup{} -lua require'nvim_lsp'.bashls.setup{} -lua require'nvim_lsp'.gopls.setup{} -lua require'nvim_lsp'.texlab.setup{} +lua << END -" requires manual `:LspInstall sumneko_lua` -lua require'nvim_lsp'.sumneko_lua.setup{} +require'nvim_lsp'.pyls.setup{} +require'nvim_lsp'.vimls.setup{} +require'nvim_lsp'.bashls.setup{} +require'nvim_lsp'.gopls.setup{} +require'nvim_lsp'.texlab.setup{} + +-- requires manual `:LspInstall sumneko_lua` +require'nvim_lsp'.sumneko_lua.setup{} + +END diff --git a/nvim/.config/nvim/spell/en.utf-8.add b/nvim/.config/nvim/spell/en.utf-8.add index 906ba3c..00f0ca4 100644 --- a/nvim/.config/nvim/spell/en.utf-8.add +++ b/nvim/.config/nvim/spell/en.utf-8.add @@ -67,3 +67,5 @@ glyphosate Monstanto univseralism universalisms +CSO +dialogue