diff --git a/coc-settings.json b/coc-settings.json new file mode 100644 index 0000000..c1b655e --- /dev/null +++ b/coc-settings.json @@ -0,0 +1,3 @@ +{ + "explorer.icon.enableNerdfont": true +} diff --git a/layers/plug/coc.vim b/layers/plug/coc.vim new file mode 100644 index 0000000..9e1fe42 --- /dev/null +++ b/layers/plug/coc.vim @@ -0,0 +1,35 @@ +vim9script + +def CheckBackspace(): bool + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +enddef + +def ShowDocumentation() + if CocAction('hasProvider', 'hover') + call CocActionAsync('doHover') + else + call feedkeys('K', 'in') + endif +enddef + +final g:coc_global_extensions = ['coc-marketplace', 'coc-json', 'coc-vimlsp', 'coc-explorer', 'coc-git'] + +tui#core#plug#Regist('neoclide/coc.nvim', { + branch: 'release', + config: () => { + set updatetime=300 + set signcolumn=yes + + inoremap coc#pum#visible() ? coc#pum#next(1) : CheckBackspace() ? "\" : coc#refresh() + inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" + inoremap coc#pum#visible() ? coc#pum#confirm() : "\u\\=coc#on_enter()\" + # Use to trigger completion + inoremap coc#refresh() + # Use K to show documentation in preview window + nnoremap K :call ShowDocumentation() + # Highlight the symbol and its references when holding the cursor + autocmd CursorHold * silent call CocActionAsync('highlight') + } +}) + diff --git a/layers/plug/init.vim b/layers/plug/init.vim index 6bef8d0..cc37fea 100644 --- a/layers/plug/init.vim +++ b/layers/plug/init.vim @@ -7,3 +7,5 @@ TuiLayer plug.nerdtree TuiLayer plug.poplar TuiLayer plug.whichkey + +TuiLayer plug.coc diff --git a/layers/plug/whichkey.vim b/layers/plug/whichkey.vim index e4c1cbd..ef4100d 100644 --- a/layers/plug/whichkey.vim +++ b/layers/plug/whichkey.vim @@ -3,11 +3,12 @@ vim9script const g:which_key_map = { f: { name: 'File', - o: ['Poplar', 'open'] + o: ['Poplar', 'open'], + x: ['q', 'quit'] }, v: { name: 'View', - f: [":NERDTreeToggle", "nerdtree"] + f: ["NERDTreeToggle", "nerdtree"] } }