ViEmu/VS: vi-vim editing
for Microsoft Visual Studio

ViEmu/VS 2.0 Release Notes

Major new features:

  • hlsearch
  • Proper vim-like visual area representation
  • Proper undo-grouping of operations (cw...)
  • Proper Intellisense-autocompleted input repetition
  • Automatic VS keybinding management
  • Advanced mapping support (":cmap <c-p> <up>", ":map \\ /xkz<esc>"...)
  • Buffer number commands :ls, :b[uffer] <n>, :bn[ext]/:bp[revious]
  • Proper wordwrapping support, better and faster folding support
  • Better incremental search, works also in visual mode

Minor new features:

  • Macros stored in regular registers
  • a..z marks local and A..Z global
  • Proper autoindent when repeating input
  • Cursor kept on screen in <c-e>/<c-y>
  • Proper <c-f>/<c-b>/<c-d>/<c-u> which always scroll
  • Proper iw/iW/ib/iB/i)/i}/i>/i] and a*... emulation
  • Proper block selections in the presence of folds/wordwrapping
  • 'o' command in visual mode
  • :delmark command
  • :xa[ll] :wqa[ll] commands
  • :vsc[md] command to trigger any VS command
  • Count support for the | motion
  • gJ implemented (join w/o adding spaces)
  • gS implemented (convert current visual range in Visual Studio selection)

Bugfixes:

  • zR now works properly
  • J/:j now properly emulate the behavior of vim regarding spacing

Details:

hlsearch

ViEmu will highlight all matches of the latest search in the current buffer... invaluable. When you switch to another buffer, it will also be scanned. If you're handling huge files, it may impact performance, so you can disable it with :set nohlsearch or in Tools|Option|ViEmu.

Proper vim-like visual area representation

ViEmu 1.x used Visual Studio's selection to represent the selected visual mode area. This had limitations, such as not being able to show the cursor inside the selection (which happens often in visual-lines mode). ViEmu 2.0 uses custom text markers to faithfully emulate how visual selection looks in vim. Much clearer. Anyway, it can be turned off if you need to preserve the previous behavior.

Proper undo-grouping of operations

Many actions in ViEmu 1.x were not grouped for undo in the same way as in vim. For example, issuing a 'cw' and then typing some text plus presing <Esc> would be undone in two steps: one for the erasing of the word, and another one for the typing. If the typing involved newlines, there would be even more steps. This was necessary because Intellisense doesn't allow regular undo-group wrappers around its actions. ViEmu 2.0 uses a more ellaborate mechanism to group undo actions, which allows proper grouping of any operation. You can see the markers ViEmu inserts in the undo queue as '---', and u/^R will use those to determine which actions to undo.

Proper Intellisense-autocompleted input repetition

Typing some text and then repeating it (most often with '.', but also possibly with a count prepended to the input command or using I or A in visual-block mode) would not work fine if you had used Intellisense in the input session. This is because Intellisense input does not go through standard input mechanisms. ViEmu 2.0 watches the changes made to the buffer to Intellisense and then deduces what sequence of typing best emulates what has been done. This results in faithful repetition of Intellisense completed input. Since the actions of each language's Intellisense are different and can be pretty weird, especially for VB, there might be some case in which it doesn't work fine - please let me know about the specific case so that I can fix it. It's been tested extensively with C++, VB.NET, C# and J#. I am aware that it doesn't work great with HTML (automatic closing tags), I plan to address it in a future release, please let me know if it is very urgent to you.

Automatic VS keybinding management

Any keybinding assigned through Visual Studio's Tools|Options|Keyboard mechanism is invisible to ViEmu, as Visual Studio 'swallows' the key press message before even dispatching it to the editor's window. ViEmu 1.x required manually removing keybindings clashing with standard vi/vim commands. Now, ViEmu 2.0 will scan the keyboard assignments the first time it is run, and remove them itself. It will also remember them, so that they can be restored when ViEmu is disabled by using <Ctrl-Shift-Alt-V> or through the preferences page. There is a keyboard manager accessible from Tools|Options|ViEmu -> Keyboard that allows you to configure the behavior, clear the list, rescan the assignments, configure which vi/vim keybindindings are considered for clashes, etc...

Advanced mapping support

ViEmu 1.x had very minimal single-character-to-single-character mapping support. ViEmu 2.0 implements all of vim's mapping options with the single exception of multiple-key-chords on the left hand side. As an example, you can map <C-N> and <C-P> in command-line editing mode to act as the up and down arrows:

:cmap <c-n> <down> :cmap <c-p> <up>

You can use 'c-', 's-' and 'a-' for Ctrl, Shift and Alt, or any combination thereof. The documentation has all the details on the supported contexts, etc...

Buffer number commands

ViEmu 2.0 keeps the list of buffers it has been exposed to and assigns numbers to them, in the same way as vim. You can use :ls to list the buffers, :b[uffer] {N} to go to a given buffer, and :bn[ext]/:bp[revious] to navigate the buffers in this order.

Proper wordwrapping support, better and faster folding support

Several actions in ViEmu 1.x didn't act well with word wrapping turned on: <C-E>/<C-Y>, H/M/L, etc... these all work great in ViEmu 2.0, and there is also an option in Tools|Options|ViEmu to turn on "Windows-like wrapped text navigation", so that j/k move up and down within wrapped pieces of the same line. Folding support has also been improved, being much faster when working with large files (it could become a bit slow in ViEmu 1.x), and with proper representation for all visual submodes (both for wrapped text and for folded text).

Better incremental search, works also in visual mode

The new incremental search uses a separate custom text marker, so it is visible even in visual mode.

Macros stored in regular registers

Macro registers were separate from regular registers in previous versions. In ViEmu 2.0, macros recorded with 'q' are stored in and played from the regular text registers. You can record a macro and paste it with "xp to see the keystrokes, or yank some text from anywhere and play it with @.

Proper autoindent when repeating input

As a result of the undo-grouping and the smart-Intellisense-sensing behavior, now input which includes newlines will be properly repeated anywhere with newly-calculated smart-indenting behavior.