3

I'd like to be able to turn it off when starting a new project and turn it back on when I have written more code.

2
5

Based on :help coc, I would use :CocDisable and :CocEnable.

If you can find a way to detect if coc is enabled (b:coc_enabled I think was mentioned in the documentation and looks helpful), you could write a smarter “toggle” command.

1

I add the same which and based on the answer of Ben Knoble I wrote:

function! CocToggle()
    if g:coc_enabled
        CocDisable
    else
        CocEnable
    endif
endfunction
command! CocToggle :call CocToggle()

It provide the CocToggle command that call either CocDisable or CocEnable depending if Coc is enabled or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.