From 1994d4894b65c55037ecd4e0456c078ed846a0b6 Mon Sep 17 00:00:00 2001 From: Adam Pippin Date: Tue, 19 Jul 2022 21:46:41 -0400 Subject: [PATCH] * Add coc extension list to plugin config to ease first-time setup * Add coc lua extension to allow us to install plugins during NukeVim install * Update docs to reflect that coc extension installation makes the install process look broken. * Migrate one of the holdover autocmds from vimscript to lua extension so it doesn't cause errors when coc is disabled --- coc-settings.json | 4 ++++ doc/nukevim.txt | 4 +++- lua/config/plugins/development.lua | 12 ++++++++++++ lua/plugin/neoclide/coc-nvim.lua | 18 ++++++++++++++++++ startup.vim | 3 --- 5 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 coc-settings.json create mode 100644 lua/plugin/neoclide/coc-nvim.lua diff --git a/coc-settings.json b/coc-settings.json new file mode 100644 index 0000000..e96f9f1 --- /dev/null +++ b/coc-settings.json @@ -0,0 +1,4 @@ +{ + "html.autoClosingTags": false, + "html.autoCreateQuotes": false +} diff --git a/doc/nukevim.txt b/doc/nukevim.txt index f9e1f5e..366c012 100644 --- a/doc/nukevim.txt +++ b/doc/nukevim.txt @@ -142,7 +142,9 @@ Check out, unzip, copy or otherwise place the repo contents in your Run `nvim +NukeVimInstall +qall` to install all the relevant plugins, perform any initial NukeVim or other plugin setup tasks, and exit. -This may take a few minutes. +This may take a few minutes and may appear to be frozen. I hope to fix this +eventually, but the coc extension is a little finnicky about how you can +install things and this is the best I could get for the time being. -------------------------------------------------------------------------------- diff --git a/lua/config/plugins/development.lua b/lua/config/plugins/development.lua index 8eeb347..4f87694 100644 --- a/lua/config/plugins/development.lua +++ b/lua/config/plugins/development.lua @@ -60,6 +60,18 @@ return { requires = { binary = { 'npm' } }, branch = 'release' }, + config = { + extensions = { + 'coc-css', + 'coc-html', + 'coc-json', + 'coc-markdownlint', + 'coc-marketplace', + 'coc-phpls', + 'coc-sql', + 'coc-yaml' + } + }, keys = { { mode = 'n', key = { '', 'c', 'r' }, map = ":call CocAction('jumpReferences')", label = "references" }, } diff --git a/lua/plugin/neoclide/coc-nvim.lua b/lua/plugin/neoclide/coc-nvim.lua new file mode 100644 index 0000000..c4dd117 --- /dev/null +++ b/lua/plugin/neoclide/coc-nvim.lua @@ -0,0 +1,18 @@ +local M = require('module'):new() + +function M:boot() + -- if you leave the cursor on a variable/etc for a moment, this will cause + -- all other occurrences to be subtly highlighted. + vim.api.nvim_create_autocmd('CursorHold', { + pattern = { '*' }, + command = "silent call CocActionAsync('highlight')" + }) +end + +function M:install() + if (self.config.extensions == nil) then return end + exts = table.concat(self.config.extensions, ' ') + vim.cmd(':CocInstall -sync '..exts) +end + +return M diff --git a/startup.vim b/startup.vim index 1123e6a..a044baa 100644 --- a/startup.vim +++ b/startup.vim @@ -99,9 +99,6 @@ function! s:show_documentation() endfunction nnoremap K :call show_documentation() -" Highlight the symbol and its references when holding the cursor. -autocmd CursorHold * silent call CocActionAsync('highlight') - " Merge the signal column (your shit broke, yo') into the number column, " or if not supported at least show it all the time so the whole text " isn't constantly shifting as errors appear/disappear.