![]()
VSCode Neovim Integration
Neovim is a fork of Vim to allow greater extensibility and integration. This extension uses a fully embedded Neovim instance, no more half-complete Vim emulation! VSCode's native functionality is used for insert mode and VSCode commands, making the best use of both editors.
init.lua and most Nvim plugins.Table of Contents
Install the vscode-neovim extension.
Install Neovim 0.10.0 or greater.
Note: Though the extension strives to be as compatible as possible with older versions of Neovim, some older versions may have quirks that are not present anymore. In light of this, certain configuration settings are recommended in some older versions for the best experience. These can be found on the wiki.
[Optional] Set the Neovim path in the extension settings under
"vscode-neovim.neovimExecutablePaths.win32/linux/darwin", respective to your system. For example,
"C:\Neovim\bin\nvim.exe" or "/usr/local/bin/nvim".
WSL Users: If you want to use Neovim from WSL, set the
useWSLconfiguration toggle and specify the Linux path to the nvim binary.wsl.exeWindows binary andwslpathLinux binary are required for this.wslpathmust be available through$PATHLinux env setting. Usewsl --listto check for the correct default Linux distribution.Snap Users: If you want to use Neovim from Snap, the Neovim path must be resolved to the snap binary location. On some systems it might be "
/snap/nvim/current/usr/bin/nvim". To check if you're running as a snap package, see ifwhich nvimresolves to/usr/bin/snap.
Since many Vim plugins can cause issues in VSCode, it is recommended to start from an empty init.vim. For a guide for
which types of plugins are supported, see troubleshooting.
Before creating an issue on Github, make sure you can reproduce the problem with an empty init.vim and no VSCode
extensions.
To determine if Neovim is running in VSCode, add to your init.vim:
if exists('g:vscode')
" VSCode extension
else
" ordinary Neovim
endif
In lua:
if vim.g.vscode then
-- VSCode extension
else
-- ordinary Neovim
end
To conditionally activate plugins, the best solution is to use the
LazyVim VSCode extra. However, packer.nvim and lazy.nvim have built-in
support for cond = vim.g.vscode and vim-plug has a
few solutions. See
plugins in the wiki for tips on configuring Vim plugins.
You can view all available settings and commands by opening the vscode-neovim extension details pane, and navigating to the features tab.
:e/:q/:vsplit/:tabnext/etc are mapped to corresponding VSCode
commands and behavior may be different (see below).:e in scripts/keybindings, they won't work. If you're using them in some custom
commands/mappings, you might need to rebind them to call VSCode commands from Neovim with
require('vscode').call() (see API).:w, :wa and :sav commands are supported and no longer alias to VSCode commands. You
can use them as you would in Neovim.abc<cursor> in insert mode, then move the cursor to a<cursor>bc and type 1 here
the repeat sequence would be 1. However, in VSCode, it would be a1bc. Another difference is that when you delete
some text in insert mode, dot repeat only works from right to left, meaning it will treat Del key as
BS keys when running dot repeat.Neovim: Restart Extension command to restart the extension.Output: Focus on Output View and select vscode-neovim logs.Debug, then click it again and choose
Set As Default.vscode-neovim.neovimClean in VSCode settings, which starts Nvim without your plugins (nvim --clean). Nvim
plugins can do anything. Visual effects in particular can cause visual artifacts. vscode-neovim does its best to
merge the visual effects of Nvim and VSCode, but it's far from perfect. You may need to disable some Nvim plugins that
cause visual effects.Unable to init vscode-neovim: command 'type' already exists message, uninstall other VSCode
extensions that use registerTextEditorCommand("type", …) (like
VSCodeVim or
Overtype).defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false."keyboard.dispatch": "keyCode".Developer: Toggle Keyboard Shortcuts Troubleshooting for tracing VSCode emitted keypresses and their processing
via defined keybindings.Developer: Inspect Key Mapping for getting the recognized mappings for the current keyboard layout inside
VSCode.If you have any performance problems (cursor jitter usually) make sure you're not using 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. Specifically, you don't need any code highlighting, completion, LSP plugins, or plugins that spawn windows/buffers (nerdtree , fuzzy-finders, etc). Most navigation/textobject/editing plugins should be fine.
For example, make sure you're not using anything that renders decorators very often:
If you're not sure, disable all other extensions, reload VSCode window, and see if the problem persists before reporting it.
Set with compositeKeys and tweak with compositeTimeout.
Examples: add to your settings.json:
jj to escape
{
"vscode-neovim.compositeKeys": {
"jj": {
"command": "vscode-neovim.escape",
},
},
}
jk to escape and save
{
"vscode-neovim.compositeKeys": {
"jk": {
// Use lua to execute any logic
"command": "vscode-neovim.lua",
"args": [
[
"local code = require('vscode')",
"code.action('vscode-neovim.escape')",
"code.action('workbench.action.files.save')",
],
],
},
},
}
VSCode's jumplist is used instead of Neovim's. This is to make VSCode native navigation (mouse click, jump to definition, etc) 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.
Multiple cursors work in:
To spawn multiple cursors from visual line/block modes type ma/mA or mi/mI (by default). The effect differs:
See gif in action:
Note: The built-in multi-cursor support may not meet your needs. Please refer to the plugin vscode-multi-cursor.nvim for more multi-cursor features
We intend to use vscode-neovim as a UI extension, so when you're using remote development, vscode-neovim is enabled in the Local Extension Host, and it should work out of the box.
If you prefer to use the remote environment's copy of Neovim, rather than the locally installed one, vscode-neovim
should be installed in the Remote Extension Host. You can set the following in your VSCode settings.json:
{
"remote.extensionKind": {
"asvetliakov.vscode-neovim": ["workspace"]
}
}
Note: You will need to install neovim in the remote environment.
For more information:
$ claude mcp add vscode-neovim \
-- python -m otcore.mcp_server <graph>