tips - theol0403/vscode-neovim GitHub Wiki
There are a few helper functions that could be used to invoke any vscode commands:
| Command | Description |
|---|---|
VSCodeNotify(command, ...) VSCodeCall(command, ...)
|
Invoke vscode command with optional arguments. |
VSCodeNotifyRange(command, line1, line2, leaveSelection ,...) VSCodeCallRange(command, line1, line2, leaveSelection, ...)
|
Produce linewise vscode selection from line1 to line2 and invoke vscode command. Setting leaveSelection to 1 keeps vscode selection active after invoking the command. |
VSCodeNotifyRangePos(command, line1, line2, pos1, pos2, leaveSelection ,...) VSCodeCallRangePos(command, line1, line2, pos1, pos2, leaveSelection, ...)
|
Produce characterwise vscode selection from line1.pos1 to line2.pos2 and invoke vscode command. |
VSCodeNotifyVisual(command, leaveSelection, ...) VSCodeCallVisual(command, leaveSelection, ...)
|
Produce linewise (visual line) or characterwise (visual and visual block) selection from visual mode selection and invoke vscode command. Behaves like VSCodeNotify/Call when visual mode is not active. |
💡 Functions with
Notifyin their name are non-blocking, the ones withCallare blocking. Generally use Notify unless you really need a blocking call.
Produce linewise/characterwise selection and show vscode commands (default binding):
function! VSCodeNotifyVisual(cmd, leaveSelection, ...)
let mode = mode()
if mode ==# 'V'
let startLine = line('v')
let endLine = line('.')
call VSCodeNotifyRange(a:cmd, startLine, endLine, a:leaveSelection, a:000)
elseif mode ==# 'v' || mode ==# "\<C-v>"
let startPos = getpos('v')
let endPos = getpos('.')
call VSCodeNotifyRangePos(a:cmd, startPos[1], endPos[1], startPos[2], endPos[2] + 1, a:leaveSelection, a:000)
else
call VSCodeNotify(a:cmd, a:000)
endif
endfunction
xnoremap <C-S-P> <Cmd>call VSCodeNotifyVisual('workbench.action.showCommands', 1)<CR>Open definition aside (default binding):
nnoremap <C-w>gd <Cmd>call VSCodeNotify('editor.action.revealDefinitionAside')<CR>Run Find in files for word under cursor in vscode:
nnoremap ? <Cmd>call VSCodeNotify('workbench.action.findInFiles', { 'query': expand('<cword>')})<CR>Since VSCode is responsible for insert mode, custom insert-mode vim mappings don't work. To map composite escape keys, put into your keybindings.json:
for jj
{
"command": "vscode-neovim.compositeEscape1",
"key": "j",
"when": "neovim.mode == insert && editorTextFocus",
"args": "j"
}to enable jk add also:
{
"command": "vscode-neovim.compositeEscape2",
"key": "k",
"when": "neovim.mode == insert && editorTextFocus",
"args": "k"
}Currently, there is no way to map both jk and kj, or to map jk without also mapping jj.
VSCode's jumplist is used instead of Neovim's. This is to make VSCode native navigation (mouse click, jump to definition, ect) navigable through the jumplist.
Make sure to bind to workbench.action.navigateBack / workbench.action.navigateForward if you're using custom
mappings. Marks (both upper & lowercased) should work fine.
Command menu has the wildmenu completion on type. The completion options appear after 1.5s (to not bother you when you
write :w or :noh). Up/Down selects the option and Tab accepts it. See the gif:

Multiple cursors work in:
- Insert mode
- Visual line mode
- Visual block mode
To spawn multiple cursors from visual line/block modes type ma/mA or mi/mI (by default). The effect differs:
- For visual line mode, mi will start insert mode on each selected line on the first non whitespace character and ma will on the end of line.
- For visual block mode, mi will start insert on each selected line before the cursor block and ma after.
- mA/mI versions accounts for empty lines (only for visual line mode, for visual block mode they're same as ma/mi).
See gif in action:

By default, the quickfix menu can be opened using z= or C-.. However, it is currently not possible to add mappings to the quickfix menu, so it can only be navigated with arrow keys. A workaround vscode extension has been made to use the quick open menu, which can be navigated with custom bindings.
To use, install the keyboard-quickfix extension, and add to your keybindings.json:
and add to your init.vim:
nnoremap z= <Cmd>call VSCodeNotify('keyboard-quickfix.openQuickFix')<CR>If you get "Unable to init vscode-neovim: command 'type' already exists" message, uninstall other VSCode extensions that
register the type command (like VSCodeVim or
Overtype).
If you have any performance problems (cursor jitter usually) make sure you're not using these kinds of extensions:
- Anything that renders decorators very often:
- Line number extensions (VSCode has built-in support for normal/relative line numbers)
- Indent guide extensions (VSCode has built-in indent guides)
- Brackets highlighter extensions (VSCode has built-in feature)
- VSCode extensions that delay the extension host like "Bracket Pair Colorizer"
- VIM plugins that increase latency and cause performance problems.
- Make sure to disable unneeded plugins, as many of them don't make sense with vscode and may cause problems.
- You don't need any code, highlighting, completion, lsp plugins as well any plugins that spawn windows/buffers (nerdtree and similar), fuzzy-finders, etc.
- Many navigation/textobject/editing plugins should be fine.
If you're not sure, disable all other extensions, reload vscode window, and see if the problem persists before reporting.
{ "key": "ctrl+.", "command": "keyboard-quickfix.openQuickFix", "when": "editorHasCodeActionsProvider && editorTextFocus && !editorReadonly" },