Open current file in vim. To activate this extension, open the Command Palette (Ctrl+Shift+P on linux or โงโP on mac) and search for "Open in Vim". Alternatively, you can assign a keyboard shortcut of your choosing.
Support for Windows is currently experimental.
Contribute on GitHub.
Useful guide: https://code.visualstudio.com/api/working-with-extensions/publishing-extension
- Install npm packages defined in package.json
$ npm install
- Install
vsce
to package/publish extensions
$ npm install -g @vscode/vsce
- Build local .vsix package
$ vsce package
-
open-in-vim.openMethod
: specifies how vim should be launched. Allowed values are tabulated below.Value Description gvim
Open vim in gVim. kitty
Open vim in Kitty. integrated-terminal
(DEFAULT) Open vim in VSCode's integrated terminal. linux.gnome-terminal
Open vim in gnome-terminal (full-screen). linux.tilix
Open vim in Tilix. macos.iterm
Open vim in iTerm2. macos.macvim
Open vim in MacVim. -
open-in-vim.vimExecutable
: CLI editor executable name (in$PATH
) or full path to it -
open-in-vim.restoreCursorAfterVim
: (EXPERIMENTAL) syncs cursor position from vim to vscode when you close vim. Assumes that thecode
executable is in the $PATH. -
Other settings for specific openMethods are tabulated below.
Setting Description Default open-in-vim.linux.gnome-terminal.args
Space-separated arguments that get passed to gnome-terminal
.--hide-menubar --full-screen
open-in-vim.linux.tilix.args
Space-separated arguments that get passed to tilix
.--full-screen
open-in-vim.integrated-terminal.pathToShell
Path to unix shell which will host the vim process. /bin/bash
orC:\Program Files\Git\bin\bash.exe
open-in-vim.macos.iterm.profile
Name of iTerm profile to use ( default profile
is a special case to use iTerm's default).default profile
If you'd like the inverse of this plugin (Open in VSCode from Vim), you can just add the following vimrc line:
:command! OpenInVSCode exe "silent !code --goto '" . expand("%") . ":" . line(".") . ":" . col(".") . "'" | redraw!
(On Mac, you'll also need to open vscode and run the command Install 'code' command in PATH
)
If you additionally want to preserve the working directory, you can add getcwd()
like so:
:command! OpenCwdInVSCode exe "silent !code '" . getcwd() . "' --goto '" . expand("%") . ":" . line(".") . ":" . col(".") . "'" | redraw!