vscode-open-in-vim
vscode-open-in-vim copied to clipboard
Plugin to open current file in vim
Open in Vim
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.
Extension Settings
-
open-in-vim.openMethod: specifies how vim should be launched. Allowed values are tabulated below.Value Description gvimOpen vim in gVim. kittyOpen vim in Kitty. integrated-terminal(DEFAULT) Open vim in VSCode's integrated terminal. linux.gnome-terminalOpen vim in gnome-terminal (full-screen). linux.tilixOpen vim in Tilix. macos.itermOpen vim in iTerm2. macos.macvimOpen vim in MacVim. -
open-in-vim.useNeovim: whether to launch vim or neovim (ignored whenopenMethodis set to gvim/macvim). -
open-in-vim.restoreCursorAfterVim: (EXPERIMENTAL) syncs cursor position from vim to vscode when you close vim. Assumes that thecodeexecutable is in the $PATH. -
Other settings for specific openMethods are tabulated below.
Setting Description Default open-in-vim.linux.gnome-terminal.argsSpace-separated arguments that get passed to gnome-terminal.--hide-menubar --full-screenopen-in-vim.linux.tilix.argsSpace-separated arguments that get passed to tilix.--full-screenopen-in-vim.integrated-terminal.pathToShellPath to unix shell which will host the vim process. /bin/bashorC:\Program Files\Git\bin\bash.exeopen-in-vim.macos.iterm.profileName of iTerm profile to use ( default profileis a special case to use iTerm's default).default profile
To do
- [ ] Support macOS' native Terminal app
Inverse Plugin
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!