Using COC on multiple instances can really take a toll on my intel i3+4GB machine.
So I was wondering if I could toggle it on demand.
I have managed to turn it off by default and toggle it on using Vimplug's built in feature like the following.
Plug 'neoclide/coc.nvim', {'branch': 'release', 'on': 'CocToggle' }
However, I'm not sure how to toggle it off.
Any help would be highly appreciated!
P.S.: I have tried CocDisable and didn't notice any practical benefits that would minimize the resource usage like killing the gazillion node processes started by COC for each instances!
Solution
I ended up writing the following function for my use case.
Plug 'neoclide/coc.nvim', {'branch': 'release' }
let g:coc_start_at_startup = 0
let s:coc_enabled = 0
function! ToggleCoc()
if s:coc_enabled == 0
let s:coc_enabled = 1
CocStart
echo 'COC on'
else
let s:coc_enabled = 0
echo 'COC off'
call coc#rpc#stop()
endif
endfunction
nnoremap <silent> <leader>h :call ToggleCoc()<cr>