VS Code is a very popular these days and it has a Vim emulator which seems to have a fairly good reputation.
See:
- Vim extension page at VS Code marketplace
- GitHub source for the above extension
- Apparently there's a NeoVim extension as well...
I wonder to which extent the Vim emulation in VS Code matches or supports Vim features and what are the main limitations.
I also think it would be nice to have a canonical answer to that question, since we sometimes get questions about VS Code here and on StackOverflow (most often on SO) and it's often unclear whether the answers that work on Vim/NeoVim will also work on VS Code using the Vim extension (or the NeoVim one.)
Specific questions on Normal mode:
- Does it support Visual Block mode?
- Does it support
Ctrl-A
andg Ctrl-A
in Visual Block mode? - Does it support registers at all?
- What about recording macros to registers, using
q
, and replaying them with@
? - How about markers? Does it support them? How about the implicit
'<
,'>
for the last visual selection, or'[
,']
for last changed or yanked text? - Clipboard registers
"*
and"+
? - Does it support folding and the Normal mode commands related to opening/closing folds or defining manual folds?
Specific questions about Ex commands (and Vimscript in general):
- Does it support Ex commands at all
- If so, does it support a few, most, or all Ex commands? Which are the ones it supports?
- Does it support
:s
,:g
,:normal
? These are often very useful when performing large edit operations. - Does it support custom keymappings at all? Does it support defining them using
:map
commands, or only a static definition using a different configuration file? - Is there a subset of Vimscript functions, variables that even works on VS Code?
- Would it be possible to come up with a vimrc that would work in both Vim and VS Code, even if VS Code would ignore many of the settings? (Similar to how it's possible to write a vimrc that works on a Vim built without support for +eval, but still loads common settings, etc.)
Regarding searching with /
and replacing with :s
(assuming those are even supported):
- Are patterns for the most part compatible with Vim patterns?
- Does it support "verymagic" (and the other modes, "nomagic", "verynomagic")?
- Does it support
\zs
and\ze
to mark start and end of the match without using backward and forward zero-width lookups? - Does it support zero-width lookups?
- Matches around the current cursor position?
Feel free to answer these in particular or to summarize what you think are big points of what's supported and what isn't.
I didn't find any documentation indicating what the level of emulation is, but maybe I didn't look closely enough... Pointers to that, if it exists, would be appreciated.