Skip to content

Instantly share code, notes, and snippets.

@khanghoang
Last active August 18, 2019 01:52
Show Gist options
  • Save khanghoang/d171ed0767e067ef4f71dac0fd82abe7 to your computer and use it in GitHub Desktop.
Save khanghoang/d171ed0767e067ef4f71dac0fd82abe7 to your computer and use it in GitHub Desktop.
Neovim plugins

Enable CodeLens in coc.nvim

You'll also need to enable the code lens feature in coc (:CocConfig):

"codeLens.enable": true

Neovim-client

Create a channel to communicate with NeoVim and its plugins https://github.com/chemzqm/node-client.
For example, you can execute a script from the plugin using

nvim.command('vsp');

More information about the above script https://github.com/chemzqm/node-client#attach

Debugging Coc.nvim

Add:

  let g:coc_node_args = ['--nolazy', '--inspect-brk=6045']

to your .vimrc and use Google Chrome extension to open it automatically. (more information)

Coc.vim

Coc.vim is an equivalent of vscode package and dedicated for writing NeoVim plugins.

How to create a sign?

It seems like there's already an abtraction layer for that purpose in coc.vim.

What's about vscode diagnostic? There is a lot of examples uses vscode's diagnostics. I've found one.

How to create a virtual text?

Call this in neovim

:call nvim_buf_set_virtual_text(0, 0, 3, [["foo"]], {})

In vscode, there is thing called CodeLens, which uses to highlight things.
Example of import-cost CodeLens

Hot reload for NeoVim plugin?

It's still up in the air about how to do that. Theoretically, we can use this function to clear all the stale modules and reload them.

Update: neovim-client hot reloads thing if the flag { dev: true } is passed.

Debugging Neovim-client

In the readme files, it states that we can pass an env variable to debug using node-inspector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment