ViEmu 2.5 Documentation
Index:
1. General
2. Integration with Visual Studio
3. ViEmu preferences page
4. The status bar
5. Miscellaneous VS integration info
6. The vi/vim input model
7. Regular expressions
8. The ex command line
9. Differences with vi and vim
10. Support
11. Change log
1. General
I hope you will find ViEmu useful!
2. Integration with Visual Studio
Starting with version 1.1, ViEmu features a new integration model with Visual Studio. ViEmu 1.1 and above hook all text editing windows in the environment and provides full vi/vim input model emulation inside them. The integration model has been designed such that it will work well with other editor enhancement add-ins, such as Whole Tomato Software's Visual Assist, JetBrains' Resharper or DevExpress' CodeRush. Version 1.4.5 provided specific hooks for a DevExpress' DxCore plugin to get the best behavior with CodeRush, while version 1.4.6 and later incorporate specific code to detect the presence of Visual Assist and Resharper, and adapt ViEmu's behavior for maximum compatibility.You needn't do anything specific to use ViEmu, just open source or text files within Visual Studio and start editing as if you were using vi or vim. The cursor will change its shape as soon as you press any key or mouse button, showing the regular vi/vim normal mode block cursor.
If you want to disable ViEmu temporarily, you can just press Ctrl-Shift-Alt-V in any moment, and ViEmu will be globally toggled on or off. You can also use the "Enable ViEmu" setting under Tools|Options|ViEmu. ViEmu will take care of restoring and removing the Visual Studio keybindings that were removed when installing it (see the next section for details on this feature and how it is configured from the ViEmu preferences page).
3. ViEmu preferences
ViEmu preferences are accessible from the Tools->Options menu. There is a folder specific to ViEmu in the folder list on the left, which contains the main ViEmu preferences page.3.1. Main preferences page
- Enable ViEmu: As mentioned above, use this checkbox to enable or disable ViEmu within Visual Studio.
-
- Ignore CAPS LOCK state in NORMAL: if this option is selected, ViEmu will look at the actual state of the SHIFT key when a command was issued, instead of paying attention to the CAPS LOCK key state. One of the most common inconveniences with the vi/vim input model is that the lowercase and uppercase version of a character invoke different commands, and if you accidently hit the CAPS LOCK key, you will be invoking the uppercase version when you intend to invoke the lowercase version and viceversa, which is a minor but annoying source of confusion. This option helps by keeping the regular command behavior even with CAPS LOCK set, and lets you discover the pressing of CAPS LOCK when you start actually typing text, which is much less of a hassle.
-
- Default yank/paste to/from Windows clipboard: in vim, you need to use the "*" register specifier to actually copy (yank) to or paste from the Windows clipboard. Unspecified yanks or pastes use the internal "0" register. If you check this option, ViEmu actually uses the "*" by default with every yank/paste, which makes it more convenient to interact with other Windows applications. The "*" still works in ViEmu to explicitly access the Windows clipboard (both with this option set or unset).
-
- Beep on errors: ViEmu will beep when some invalid input is received if this option is selected, in the same way that vi/vim do. Uncheck it to have a "silent" ViEmu.
-
- Insert a Visual Studio mark when a ViEmu mark is set: The mark system within ViEmu is a separate system from standard Visual Studio marks, for proper vi/vim emulation purposes. This option enables you to instruct ViEmu to insert an extra Visual Studio mark when you set a ViEmu mark with the 'm' command. Visual Studio marks are visible in the left margin of the text editor (or, if you don't have a margin, as a different background color for the relevant line).
-
- Prevent VS2005+ warning "cannot edit while running": This option is specific to VS2005 and later. When working on a .NET application, if the application or some of its threads is running, VS will block attempts at editing any source file and issue a warning message box. Unfortunately, VS confuses regular keys that simply allow navigating the file with ViEmu (such as 'h/j/k/l', 'w', etc...) with attempts to edit the file, making vi-style navigation unusable. Setting this flag will clear an internal flag in the file buffer, which VS uses to mark files while the target is running. This also has the side effect of allowing changes to the file.
-
- Use Visual Studio selection for Visual mode: By default, ViEmu uses a custom text marker to highlight the area selected in visual mode. This allows a very faithful emulation of vim's visual mode behavior, including having the cursor within the selected region (as happens naturally in visual lines mode), etc. This setting can be used to make ViEmu use VS's selection instead of the custom marker, which will be less precise, but may be useful if you need to operate using the VS selection with external functionality. An alternative if you want to use ViEmu's "emulated" selection, and you still need to go into VS-selection mode from time to time is to use the gS command when you need to do the conversion (this only lasts until the next ViEmu keypress).
-
- Windows-like word wrap navigation: By default, ViEmu emulates vim's behavior in which j/k move to the physical lines above or below the current one, making them jump several lines in the case of word wrapped lines. If you enable this setting, the j/k motions will move by screen lines, resembling the default behavior of the Up and Down cursor keys in Visual Studio and most Windows applications. 0 and $ will also move to the beginning and the end of the current 'wrap' portion. Line ranges are still considered by physical division, so 'dd' will erase a full line, even if it is wordwrapped into several visual lines.
-
- Warn before long operation on read-only file: Since commands like ViEmu "Paste" can internally involve many operations, and since VS might ask for confirmation on each of them if the file is read-only, this setting makes ViEmu ask first.
-
- ignorecase, smartcase, incsearch, hlsearch: These options control the vi/vim standard variables of the same names, which are usually accessed using the :set commmand. Unlike when setting them using the :set command, when set through this dialog their value is persisted by the preferences system.
-
- ignorecase controls the case sensitivity of the searches done using the '/' and '?' commands.
-
- smartcase: This option activates 'Smart case sensitivity'. This setting only works if 'ignorecase' is on. In that situation, if a search string is entered containing at least one upper-case character, case-sensitive behavior is used for that search. These allows using case insensitive searches most of the time, by typing only lowercase characters, and still for case sensitive behavior for a given search by typing some uppercase character.
-
- incsearch this setting controls incremental search, that is, whether the cursor is placed at the first match of the search target while the search is being typed (the match is also higlighted).
-
- hlsearch this setting controls search highlighting, which will mark with a different background the all matches of the search string in the current file. It will also highlight them when switching to a new file. ViEmu goes to great lengths not to scan unnecessarily, and to perform incremental calculations, so this feature should not noticeably impact performance even in the case of very large files.
-
- Keyboard button: this button brings up the keybinding management dialog.
-
- The bottom of the preferences page provides links to this documentation, to the ViEmu web site, and a note on the registration info of the current copy of ViEmu.
3.2. Keyboard management tool
When you click on the 'Keyboard' button in the main ViEmu preferences page, the following dialog is displayed:The first time ViEmu is run, it will scan the current keybindings and it will remove the ones that clash with most standard vi/vim commands, that is, <Control> plus one of the following keys: R, F, B, D, U, W, T, Q, E, Y, O, I, N, P, or ]. Although Ctrl-V and Ctrl-C perform operations in vi/vim input (enter block-visual mode and cancel the command), 'C' and 'V' are not included by default so that their common binding of copy and paste remain untouched.
In VS.NET 2002 or 2003, modifying the current keybindings is impossible if the currently selected keyboard scheme is one of the built-in ones. For that reason, and in order to do modifications in a separate map, ViEmu will create a new map named "ViEmu" before doing any modifications.
Apart from removing them, ViEmu remembers the removed assignment, which are shown in the list on the left of this dialog. When ViEmu is later deactivated either using the 'Enable' setting in the main dialog, or pressing the quick-toggle Ctrl-Shift-Alt-V, ViEmu takes care of restoring these keybindings, so that the editor will work exactly the same as it did before it was installed. ViEmu also removes the assignments again when it is reactivated, so that the vi/vim function of these keys is available.
The 'Restore/Remove' check box on the top of this dialog controls this automatic management, in case you prefer to turn it off for some reason.
ViEmu also rescans all the active assignments on startup, and notifies you in case there is any clashing keybinding (which may happen as a result of modifying key assignment using VS's standard Keyboard customization features. In case clashes are found, ViEmu will inform you and offer to open the keyboard management tool. You can use the second checkbox above to disable this scanning on startup.
The second list on the right of this dialog shows the currently clashing key assignments. This can allow you to understand why some ViEmu key may not work.
The buttons below the lists allow you to manage the list of keybindings that ViEmu dynamically manages. You can clear the list of assignments to manage ('Forget'), you can restore them ('Restore'), which will make them show on the second list (as they will now be clashing), you can remove the clashing keybindings and remember them ('Save and remove'), or you can just remove them ('Remove'). If you reset the keybindings to some default values, and you want ViEmu to rescan it and grab the clashing keys for dynamic management, your best bet is to (1) 'Forget' the current list, and (2) 'Save and remove' the currently clashing ones. some ViEmu key may not work.
In case you'd like ViEmu not to consider some of the standard keys for clash detection, you can edit the list of keys scanned for clashing purposes. For example, if you want to leave Ctrl-F alone, you can remove the 'F' from the list, and click on 'Apply' to save the setting and rescan the current keybindings. If ViEmu previously removed the Ctrl-F keybinding and you want to restore it, the simplest sequenced of steps is:
- Remove the offending key from the list of scanned keys
- Click on 'Apply' to save the setting
- Click on the 'Restore' button to restore the original keybindings
- Now, the previously offending keybinding won't appear in the list on the right as it is no longer considered
- Finally, click on the 'Save and Remove' button to remove these keybindings and remember them for later restoring
One limitation of the automatic management is that a set of keybindings for a command, which may include more than one combination, is managed as a single entity, and restored/removed as a whole. This is excessive for commands which have several keybindings, only one of which may clash - all of the assignments will be removed and restored as a whole.
3.3. Common tasks
If you want to modify any other assignments in Visual Studio's Tools|Options|Keyboard and have ViEmu rescan it, these are the steps to follow:- Go to Tools|Options|ViEmu->Keyboard
- Click the "Restore" button under the saved keybindings list to restore the initial pre-scan state.
- Click the "Forget" button under the saved keybindings list to make ViEmu clear the remembered list. After this, the list on the left should be empty, and the list on the right will probably show a lot of clashing keybindings.
- Go to Tools|Options|Keyboard
- Perform the necessary modifications (select the new scheme, add or remove keybindings, etc...)
- Close the Tools|Options dialog - this is important so that the Tools|Options|Keyboard page will commit all of its changes
- Go to Tools|Options|Viemu->Keyboard again
- Click on the button "Save and Remove" under the current clashing keybindings list
If you want ViEmu to keep most of the current keybindings for automatic activation/deactivation purposes, but you want to remove one of these keys from the list, these are the steps to follow:
- Go to Tools|Options|ViEmu->Keyboard
- Click the "Restore" button under the saved keybindings list (to restore the initial pre-scan state).
- Click the "Forget" button under the saved keybindings list to make ViEmu clear the remembered list. After this, the list on the left should be empty, and the list on the right will probably show a lot of clashing keybindings.
- Change the list of keys scanned to add/remove any one you don't like (for example, change from the default "RFBDUWTQEYOINP]" to "RFBDUWTQEYOINP]V" to add Ctrl+V to the combinations checked and thus remove the regular "Paste" binding from Ctrl+V, and leave it free to enter visual-block mode.
- Click the "Apply" button (the list on the right should now show "Edit.Paste" as a clashing keybinding)
- Click on the button "Save and Remove" under the current clashing keybindings list
If ViEmu has removed a non-clashing keybinding, this is because the same command had another keybinding assigned which did clash. ViEmu 2.5 is limited to removing/restoring the full set of keybindings for a given command. This happens, for example, with the command Edit.ViewWhitespace, which is often assigned both to Ctrl+Shift+8 and to the sequence Ctrl+R, Ctrl+W. The bindings are removed because the 'Ctrl+R, Ctrl+W' sequence conflicts with ViEmu Ctrl-R for 'Redo'. If you want to restore the other keybinding, that is, Ctrl+Shift+8, which doesn't actually clash, these are the steps to do it:
- Go to Tools|Options|ViEmu->Keyboard
- Click the "Restore" button under the saved keybindings list (to restore the initial pre-scan state).
- Click the "Forget" button under the saved keybindings list to make ViEmu clear the remembered list. After this, the list on the left should be empty, and the list on the right will probably show a lot of clashing keybindings.
- Go to Tools|Options|Keyboard
- Type Edit.ViewWhitespace in the command description, select the Ctrl+R, Ctrl+W keybiding from the dropdown, and click "Remove"
- Close the Tools|Options dialog - this is important so that the Tools|Options|Keyboard page will commit all of its changes
- Go to Tools|Options|Viemu->Keyboard again
- Click on the button "Save and Remove" under the current clashing keybindings list
4. The status bar
When you are editing a file with ViEmu, you will notice that the status bar shows the current state of ViEmu. It first shows the mode ViEmu is in (NORMAL, INSERT, REPLACE, VISUAL, VISUAL-LINES or VISUAL-BLOCK). Apart from this, it also shows the current partial command that you have input, as is common in vi/vim.When you switch away from ViEmu to another type of window within VS, the status bar text will keep the last ViEmu output until you do some other action that changes it - this doesn't mean that ViEmu is active, but it can be confusing at times.
5. Miscellaneous VS integration info
When you enter input mode, all input is filtered through Visual Studios's input system, which includes Intellisense and possibly other editor enhancement add-ins. This way, you have all regular Intellisense features available: method autocompletion drop down, function-call hints, etc. Starting with ViEmu 2.0, ViEmu takes note of the input generated by these actions, and can thus properly reproduce this input afterwards: if you enter input mode with '2i', the text typed will be repeated after ending input mode with ESC whatever Intellisense actions you performed.ViEmu is available both with regular text editing windows, as well as within "double-mode" editors such as the HTML editor or the VB form editor.
Visual Studio shortcut keys are available within ViEmu. Actually, due to the internal architecture of Visual Studio, they take precedence over ViEmu. This can cause some trouble, given that many of the standard vi/vim commands clash with common Windows and VS shortcuts. For example, Ctrl-O is used to go back in the position history in vi/vim, and it represents File/Open in most Windows programs and in VS itself. Keyboard shortcuts override any assigned ViEmu behavior, so by default Ctrl-O would bring up the File/Open dialog even with ViEmu active. In order to make the vi/vim emulated behavior accessible, the shortcut key needs to be removed from Tools|Options|Keyboard. If several multiple-key combinations starting with the same keypress are bound to different commands, as is often the case with Ctrl-R, it's also necessary to remove all of them for ViEmu to receive the keystroke. Starting with ViEmu 2.0, ViEmu will automatically remove these keybindings the first time it is run, saving them for later restoring any time it is deactivated - this allows easy toggling off of ViEmu with Ctrl-Shift-Alt-V, including restoring the function of the clashing keybindings.
The support for the whole :*map familiy of functions (including their regular and their :*noremap side) is fairly complete, with a single exception: only single keypresses can be mapped (although they can be mapped to an unlimited sequence of keystrokes). Mapping of 'chords' (for example, ":map c_ ct_") requires managing ambiguous input sequences and timing limits to resolve them, and this will be implemented in a later version of ViEmu.
Even if you enable beyond-end-of-line ("virtual") editing in VS, ViEmu currently is not able to handle it.
ViEmu does its own clipboard handling, both for internal named registers (0-9, a-z) and for the default clipboard. This allows ViEmu to recreate vi/vim's distinction of character, line and block selections. This may not work well with other clipboard enhancers for VS.
Althouh we've tried to implement ViEmu in the most compatible manner, ViEmu may not work well (or at all!) with other VS add-ins. Starting with version 1.1, We have made a great effort to make ViEmu compatible both with JetBrains' Resharper and Whole Tomato Software's Visual Assist. Version 1.4.3 also made some allowances to work together with Workspace Whiz. Version 1.4.5 included support for a specific compatibility plugin for DevExpress' CodeRush, and version 1.4.6 brought some specific internal code to detect the presence of Visual Assist and Resharper to obtain maximum compatibility. Full information is available in this web page. Please tell us about any compatibility problems you may find.
Starting with version 1.3, ViEmu supports a quite functional ex command line subset emulation. Check the ex emulation section below for details.
You can use the combination Ctrl-Shift-Alt-V in any moment to globally toggle ViEmu on or off.
Please take into account that once you command a search from VS's find dialog, or the quick-find combo box in VS, ViEmu automatically enters VISUAL mode with the result of the search. This is due to the fact that VS's search actually selects the resulting text, and ViEmu always enters visual selection mode when some external element has selected a piece of text (such as, making a selection with the mouse). You need to exit visual mode explicitly with ESC if you want to revert to normal mode.
The three types of custom text markers ViEmu uses, for the visual mode selection, the incremental search, and hlsearch, can be configured to any color in the standard Visual Studio Tools|Options|Environment|Fonts and Colors dialog. Look for "ViEmu Selection", "ViEmu Incremental Search" and "ViEmu hlsearch". Their default values are taken from the default vim color scheme.
6. The vi/vim input model
We have made available a vi/vim graphical reference and tutorial, which covers the most important part of the vi/vim input model. Be sure to check it out if you want a good reference or a general introduction to vi/vim editing.ViEmu accepts commands along the vi/vim input model. This means that input is separated in pieces that are parsed as they are entered, and the command is 'kicked' when the parsing determines that there is a complete command to execute. The partial input entered up to the moment is displayed on the status bar. An incomplete command can be cancelled by pressing ESC.
A command may be composed by the following elements:
- One or more register specifiers (a quote followed by another character, for example,
"a
) - One or more counts (a decimal number, such as
12
) - A command (which may be followed by other elements depending of the type of commands)
Some commands are direct-action commands (for example, 'x' deletes the current character). These commands kick ViEmu to act as they are typed, optionally with a count and/or register specifier.
Other commands require a character argument (for example, 'm' which requires a mark identifier afterwards, or 't' which expects which character to look for after it). These commands wait for the character and then kick the action.
Another set of commands are called 'motions', which involve moving around the edited file. They are also kicked as soon as typed (for example, 'l' means 'move cursor right' or 'w' means 'next beginning of word).
Finally a very important set of commands are called 'operators'. These commands act upon a region of text doing some action on it (for example, 'd' deletes the region, 'gU' makes it uppercase, and 'y' copies the region to a register). These commands wait for a motion after entering them, and then act on the text between the current position and the motion target. The motion can have a count itself, such that 'd2w' deletes the next two words. In visual selection mode, operators don't wait for a motion and, instead, act on the selected region of text - this is an improvement of vim over the original vi and is actually very useful.
ViEmu implements most of vi/vim's core commands, including operators and motions. Some obscure ones are not implemented (such as ROT13 encoding), as well as some advanced ones (such as line autocompletion in input mode).
Motions
- 0: move to hard beg-of-line (column 0)
- '$': move to end-of-line
- '^': move to soft beg-of-line (first non-space character)
- '-': move to soft beg-of-line of the previous line
- '+', <RETURN>: move to soft beg-of-line of the next line
- '_': move to soft beg-of-line of the current line (if count given, N lines below)
- '|': move to column as given by count (default 0)
- hjkl move left, down, up and right
- Ctrl-P/Ctrl-N: up and down (same as k/j)
- w: move to next beginning of "word"
- b: move to previous beginning of "word"
- e: move to next end of "word"
- ge: move to previous end of "word"
- W: move to next beginning of "WORD"
- B: move to previous beginning of "WORD"
- E: move to next end of "WORD"
- gE: move to previous end of "WORD"
- f* ('*' is any character you type): move to next appearance of the character in this line
- F*: move to previous appearance of the character in this line
- t*: move to just before the next appearance of the character in this line
- T*: move to just after the previous appearance of the character in this line
- ';': repeat last character-in-line search done (one of tTfF)
- ',': repeat backwards last character-in-line search done (one of tTfF)
- H: move to soft beg-of-line of the line at the top of the screen
- M: move to soft beg-of-line of the line at the middle of the screen
- L: move to soft beg-of-line of the line at the bottom of the screen
- '`*' ('*' is a mark specifier): move to the position of the given mark) - mark '.' is the last edited position, '<' and '>' are the last visual selection endpoints, '[' and ']' are the start and end-point of the last text modification, yank or paste, and '^' is the location where insert mode was last exited. Lowercase marks are local to the buffer, uppercase ones are global (and jumping to them isn't really a 'motion')
- ''*' ('*' is a mark specifier): move to the soft-beg-of-line of the position of the given mark)
- gg: move to the top of the file (if a count is given, move to that line)
- G: move to the end of the file (if a count is given, move to that line)
- '%': move to the matching parenthesis (or similar). If not on matching character, first scan for the next matching character on the line. If beyond end of line, try maching at the last character of the line. If a count is given, move to that percent of the whole file instead
- '/arg<return>': (find) move the next occurlnce of "arg" in the file - incrementally shows place while parsing, but you can press ESC to cancel it and go back to where you where
- '?arg<return>': same as previous one, but backwards
- n: repeat last find ('/' or '?', or '*' or '#')
- N: repeat last find with reversed sense (will do backwards if it was '/' or forwards '?')
- '*': (literal asterisk) find the next occurrence of the identifier under the cursor
- '#': (literal hash) find the previous occurrence of the identifier under the cursor
- 'g*': (literal asterisk) find the next occurrence of the identifier under the cursor, not required to be a full-word match
- 'g#': (literal hash) find the previous occurrence of the identifier under the cursor, not required to be a full-word match
- Ctrl-d: move the cursor down and scroll half a screenful of text - this works in vim, but is not a motion
- Ctrl-u: move the cursor up and scroll half a screenful of text - this works in vim, but is not a motion
- Ctrl-f: move the cursor down and scroll a screenful of text - this works in vim, but is not a motion
- Ctrl-b: move the cursor up and scroll a screenful of text - this works in vim, but is not a motion
- ( or ): move to previous beginning or next end of sentence, as indicated by periods or other punctuation signs.
- { or }: move to the previous beginning or next end of paragraph, as indicated by fully empty lines
- [[ or ]]: move to the previous or next open brace in the first column - useful to navigate C/C++ source code.
- [] or []: move to the previous or next close brace in the first column - useful to navigate C/C++ source code.
- z<return>, z. or z-: move to the soft beg-of-line, but also scroll the file to put the current line at the top/center/bottom of the screen
- [( and ]): move to previous or next unmatched parenthesis - it steps over properly matched parentheses
- [{ and ]}: likewise with braces
- Ctrl-i and Ctrl-o: move to next or previous position in the "position history" of last visited places. If the previous position is in another file, it doesn't act like a motion, but if it is on the same file, it acts as a motion (unlike vi/vim.)
- special text-block motions: these motions act especially, as they determine not only the end but also the beginning of the acted upon region. They cannot be entered as regular motions in normal mode, as they start with 'i' or 'a' which are valid commands - they can only be used as arguments to operators or in visual mode. They fully determine the region on which to operate when used as operator arguments, and they extend the current selection in visual mode. The 'inner' version does not pick spaces afterwards, while the 'a' version does:
- iw or aw ("inner word"/"a word"): "word" currently under the cursor
- iW or aW: likewise with a "WORD"
- is or as: likewise with a sentence (see '(' and ')')
- ip or ap: likewise with a paragraph (see '{' and '}')
- i) or a): (also works with '(') ) parentheses delimited block
- i] or a]: (also works with '[') ) square bracket delimited block
- i> or a>: (also works with '<') ) angle-bracket delimited block
- i' or a': single-quote delimited block, limited to the current line, ignores '/' escaped quotes, counts quotes from start-of-line if done from an ambiguous quote
- i" or a": double-quote delimited block, limited to the current line, ignores '/' escaped quotes, counts quotes from start-of-line if done from an ambiguous quote
Regular commands
- i: enter input mode at current position
- a: enter input mode just after the character after the current position
- gi: enter input mode where insert-mode was last exited
- I: enter input mode at soft beginning-of-line
- gI: enter input mode at hard beginning-of-line
- A: enter input mode after end of line
- R: enter input mode in overtype mode
- o,O: (normal) insert an empty line (below,above) the current line and enter input mode there
- s: delete current character and enter input mode
- S: remove all characters from current line and enter input mode
- C: remove all characters to end-of-line and enter input mode
- x: delete character under the cursor
- X: delete character before the cursor
- '~': toggle case of current character
- 'r*' (where '*' is any character): replace current character with the given character
- J: join the current line with the next one, leaving exactly one space between them
- gJ: join the current line with the next one, leave whitespace as it is
- u: undo last action
- Ctrl-r: redo last undone action
- D: remove all characters to end-of-line
- Y: yank current line
- p: paste after current position
- P: paste at current position
- ]p: paste after current position and reindent
- ]P, [p, [P: paste before current position and reindent
- gp/gP: paste after or before cursor, then, leave cursor after the pasted test
- v: enter visual-character selection mode
- V: enter visual-linewise selection mode
- Ctrl-v: enter visual-block selection mode (Ctrl-Q also maps to this command)
- gv: enter visual mode with the last selected range and selection mode
- o,O: (visual) toggle the cursor between the end and the beginning of the visual region
- gS: convert the current visual range into the Visual Studio selection (useful right before using non-ViEmu commands)
- 'q*' (where '*' is a macro specifier character): start recording a macro into given register (same as regular registers)
- '@*' (where '*' is a macro specifier character): play the macro from given macro register (@@ repeats last)
- 'm*' (where '*' is a mark specifier character): set the position for mark (lowercase marks are buffer-local, uppercase ones are global)
- 'zt', 'zz' and 'zb': scroll the view so that current line is at top/middle/bottom of the screen
- Ctrl-e, Ctrl-y: scroll the view one line upwards/downwards (keep cursor on screen)
- Ctrl-]: jump to the definition of the symbol under the cursor
- Ctrl-T: jump back to the position before the previous "go to definition"
- gd: go to the local definition of the symbol under the cursor (goes to the line above the first '{' in column 0 searching backwards, then searches for symbol)
- Ctrl-^: jump to the previous buffer (optional count indicates buffer number)
- ^Ws: split current window if it's not already a split (^W means Ctrl-W)
- ^W^W, ^Ww, ^Wj, ^Wk, ^W plus up/down cursors: toggle from one split of the current pane to the other
- zc, zo, za or zA: toggle the current fold from open to closed, or viceversa
- zd: remove the current fold (not the text, but just the fold markers)
- zR: expand all folds
- zM: collapse all folds
- gf: open file under cursor
- gt/gT: go to next/previous buffer in buffer list
- ZZ: save current file and close it (same as :wq)
- Ctrl-A/Ctrl-X: increment/decrement the number under the cursor (decimal, hex, octal and alpha supported, see nrformats option)
- '.': (probably the most useful vi/vim command) repeat last command
Operators
They all wait for a motion in normal mode or act on the visually selected region in visual selection mode. They all use the specified register if there is one, or the default if there is no one specified (default may be the "*" Windows clipboard or the internal "0" register depending on an options on the preferences page).- d: delete the specified region
- c: delete the specified region and enter input mode
- y: yank (copy) the specified region
- gU: make all the characters in the specified region uppercase
- gu: make all the characters in the specified region lowercase
- g~: toggle the case of all the characters in the specified region
- >: indent all the lines in the specified region
- <: unindent all the lines in the specified region
- zf: create and collapse a fold for the enclosed text
- gq or =: autoreformat the text in the specified region (via VS's autoformatting mechanism)
Other
In insert mode, you can use the special Ctrl-T and Ctrl-D to indent/unindent the currently edited line.Also in insert mode, Ctrl-Y copies the character from the line above, and Ctrl-E the one from the line below.
In insert and command line editing mode, you can use Ctrl-R followed by a register specifier to recall the contents of that register (use " or any other non-alphanumeric symbol after Ctrl-R to recall the contents of the default register).
While editing at the command line, be it a '/' or '?' search or an ex command line, you can use Ctrl-Y to yank the full contents of the command line into the default register/clipboard.
Also in insert or command line editing mode, Ctrl-U deletes back to the start of the edit, and Ctrl-W deletes the word before the cursor.
7. Regular expressions
7.1. Introduction
7.2. Searching vs matching
7.3. Magic
7.4. Basic multis
Let's see some examples of them applied to regular characters:
a/+: This matches "a", "aa" or even "aaaaaa". It matches the two 'a's in "bbaacc".
a/=b: matches "ab", "b", and matches "cdeb" at the 'b' character.
7.5. Beginning and end of line
7.6. Sets
- [:alnum:]: alphanumeric character (same as [0-9A-Za-z])
- [:cntrl:]: control character (ascii 0 through 31)
- [:graph:]: printable character excluding space (ascii 33 through 126)
- [:punct:]: punctuation character (those for which the system's ispunct returns true)
7.7. Character classes
- /i: identifier [_a-zA-Z0-9] (isident)
- /I: identifier w/o digits [_a-zA-Z]
- /k: keyword [_a-zA-Z0-9] (iskeyword)
- /K: keyword w/o digits [_a-zA-Z]
- /f: filename [_a-zA-Z0-9.///] (isfname)
- /F: filename w/o digits [_a-zA-Z.///]
- /p: printable [ -~] (isprint)
- /P: printable w/o digits [ -/:-~]
- /s: whitespace [ /t]
- /S: not whitespace [^ /t]
- /d: digit [0-9]
- /D: not digit [^0-9]
- /x: hex digit [0-9A-Fa-f]
- /X: not hex digit [^0-9A-Fa-f]
- /o: octal digit [0-7]
- /O: not octal digit [^0-7]
- /w: word [0-9A-Za-z_]
- /W: not word [^0-9A-Za-z_]
- /h: head of word [A-Za-z_]
- /H: not head of word [^A-Za-z_]
- /a: alphabetic [A-Za-z]
- /A: not alphabetic [^A-Za-z]
- /l: lowercase [a-z]
- /L: not lowercase [^a-z]
- /u: uppercase [A-Z]
- /U: not uppercase [^A-Z]
7.8. Subexpressions
"/(ab/)c" matches the same as "abc", namely, the "abc" string
7.9. Advanced multis: counted repetitions and greediness control
7.10. Case sensitivity
Case determination is done as is default given the ViEmu 'ignorecase' and 'smartcase' options.
If 'ignorecase' is turned off, every character matches only itself.
7.11. Miscellaneous
Word beginning/end
Match-extent override
Branches
Concats
Special characters
7.12. Multi-line matching
7.13. vim regex features not supported by ViEmu
- ~ (match last :s substituted string)
- /@>: which is a multi which does not retry after the first match is done
- /@=: multi that turns the previous atom in a zero-width match
- /@!: multi that matches with zero-width if the preceding atom does NOT match
- /@<=: multi that causes first looking for the second part, then checks for the first
- /@<!: multi that causes first looking for the second part, then checks that the first does NOT match!
- /%^ (beg-of-file), /%$ (end-of-file), /%# (cursor-pos), /%23l (specific line), /%23c (col) and /%23v (vcol)
- /%[: optional tail ("wh/%[atever]")
- vim detects & prevents "multis" following possibly empty matches (such as /(/)* or even /zs*)
- ^ and $ detected as "special" not only at pure regex start and end, but also at branch and subexpression endpoints
- /Z (ignore differences in unicode combining chars)
7.14. Detail of magic mode
meaning | verynomagic | nomagic | magic | verymagic |
zero-width end-of-line | /$ | $ | $ | $ |
zero-width start-of-line | /^ | ^ | ^ | ^ |
zero-width end-of-line | /. | /. | . | . |
zero-or-more times the previous elem | /* | /* | * | * |
one-or-more times the previous elem | /+ | /+ | /+ | + |
zero-or-one times the previous elem | /= | /= | /= | = |
zero-or-one times the previous elem | /? | /? | /? | ? |
start of set definition | /[ | /[ | [ | [ |
start of counted-repetitions token | /{ | /{ | /{ | { |
start of grouped subexpression | /( | /( | /( | ( |
end of grouped subexpression | /) | /) | /) | ) |
zero-width beginning of word | /< | /< | /< | < |
zero-width end of word | /> | /> | /> | > |
branch separator | /| | /| | /| | | |
concat separator | /& | /& | /& | & |
7.15. Operator precedence
These are the operators, in highest-to-lowest precedence order:
8. The ex command line
General
- :new: brings up the VS "New File" dialog
- :q[uit]: (that is, the "uit" part is optional and ellidable) closes the current file
- :qa[ll]: closes all open files
- :wq or :x: saves and closes the current file
- :e[dit]: brings up the File/Open VS dialog, or, if given an argument, tries to open that file
- :w[rite]: saves the current file
- :wa[ll]: saves all modified files
- :sp[lit]: splits the current editing window (or closes the second view if it is already split)
- :bd[elete]: closes the current file
- :xa[ll] or :wqa[ll]: saves and closes all open files
- :clo[se]: closes the current file, or window split
- :f[ile]: shows information about the current file and cursor position in the status bar
- :ls: shows the buffer list with their buffer numbers
- :b[uffer] {N}: goes to buffer N (1-based)
- :bn[ext] or :n[ext]: goes to next file in the buffer list
- :bp[revious] or :N[ext]: goes to previous file in the buffer list
- :bui[ld]: starts a build of the current solution
- :prb[uild]: starts a build of the current project
- :comp[ile]: starts a compilation of the current file
- :deb[ug]: starts a debug session of the current solution
- :cn[ext]: jumps to next compilation error
- :cp[rev]: jumps to previous compilation error
- :ern[ext]: jumps to next error
- :erp[rev]: jumps to previous error
- :ta[g]: jumps to the definition of the identifier under the cursor
- :fd: brings up the VS Find dialog
- :mac[ro]: executes the given Visual Studio macro. Full scope needed (eg, ":macro MyMacros.Module1.myMacro")
- :vsc[md]: execute the Visual Studio command given as an argument, for example, View.SolutionExplorer
- :ve[rsion]: shows the ViEmu version
:[range]command[!]args
The arguments are command-specific, and their function is described with each command.
Core ex commands
This is the list of the core ex commands ViEmu implements:
- :set param - basic implementation allowing [no]ig[norecase]/[no]ic, [no]sm[artcase]/[no]sc, [no]ma[gic], and [no]viu[ndo]
- :*map family of commands to map an input key sequence to another arbitrary sequence of keys
- :*noremap family of commands for mapping w/o further mapping processing
- :*unmap to remove mappings
- :[range]d[elete] [x] [count] to delete (x is the register)
- :[range]y[ank] [x] [count] to yank (x is the register)
- :[range]j[oin] [!] to join the lines in the range, or default to the given line (or cursor line) and the next
- :[line] pu[t] [!] [x] to paste after (!=before) the given address (x is the register)
- :[range]co[py] [dest] to copy the lines in range to the destination address (:t is a synonim for this)
- :[range]m[ove] [dest] to move the lines in range to the destination address
- :[range]p[rint] [count] to print the lines (send them to the output window) (:P is a synonim for this)
- :[range]nu[mber] [count] to print the lines (send them to the output window), w/line number (:# is a synonim for this)
- :[range]s[ubstitute]/re/sub/[g] to substitute matches for the given regex with sub (do not give 'g' for only 1st match on each line)
- :[range]g[lobal] [!]/re/cmd to run ':cmd' on all lines matching the given regex (! = *not* matching)
- :[range]v[global] /re/cmd to run ':cmd' on all lines *not* matching the given regex
- :[range]> indents all lines in the range
- :[range]< unindents all lines in the range
- :delm[ark] {mark(s)} removes one or more marks (jumping to them will fail afterwards)
- :noh[lsearch] disables hlsearch highlighting until next search
- :u[ndo] undoes the last action or action group
- :red[o] redoes the last undone action or action group
And this is a detailed explanation of each:
:set
":set" alone or ":set all" shows the current state of all settings.
"hlsearch" enables highlighting of all matches of the last search performed in the current buffer.
"remap" enables recursively applying mappings to keys gotten from a remapping.
"list" controls the visibility whitespace and tab characters.
:d[elete]
:y[ank]
It works the same way as :d[elete], but doesn't delete the text (it copies it to the given register)
:j[oin]
:pu[t]
:co[py] / :t
:t is just a synonym of :co[py].
:m[ove]
:p[rint] / :# / :nu[mber] / :P[rint]
:g[lobal]
:[range]g[lobal][!]/regex/command
If the regular expression field is empty (:g//...), the last search string will be used.
:v[global]
:[range]v[global]/regex/command
:s[ubstitute]
:[range]s[ubstitute]/regex/replacement/[g]
If the regular expression field is empty (:s//...), the last search string will be used.
As an example, :%s//s/+$// will delete trailing whitespace on all lines.
:&
Repeats the last :s, overriding the original 'g' option with the given one, on the given range.
:*map family
:map <fromkeys> <tokeys> :map! <fromkeys> <tokeys> :nmap <fromkeys> <tokeys> :vmap <fromkeys> <tokeys> :omap <fromkeys> <tokeys> :imap <fromkeys> <tokeys> :lmap <fromkeys> <tokeys> :cmap <fromkeys> <tokeys>
These are the different contexts with their meanings:
- normal, visual, insert: refer to each of the modes.
- command-line: refers to command line editing, both for '/' searches and ':' ex commands.
- operator: refers to the situation of ViEmu being waiting for the motion after an operator command
- language: this refers to insert mode, command line editing, or the part of commands that is composed of content-characters (the argument to the f/F/t/T motions, the argument of 'r', etc...)
:*noremap family
:noremap <fromkeys> <tokeys> :noremap! <fromkeys> <tokeys> :nnoremap <fromkeys> <tokeys> :vnoremap <fromkeys> <tokeys> :onoremap <fromkeys> <tokeys> :inoremap <fromkeys> <tokeys> :lnoremap <fromkeys> <tokeys> :cnoremap <fromkeys> <tokeys>See :*map. The operation is the same, except that the right-hand-side key sequence will be interpreted directly and it won't be scanned for mappings.
:*unm[ap] family
:unmap <keys> :unmap! <keys> :nunmap <keys> :vunmap <keys> :ounmap <keys> :iunmap <keys> :lunmap <keys> :cunmap <keys>
:delm[ark] {marks}
Ex ranges
Initialization file: .viemurc
Empty lines are skipped, and comments can be inserted in the file by inserting a " to begin the line
9. Differences with vi and vim
Things emulated slightly differently (for better integration)
If you find that any of these is troublesome, please tell us so that they can be addressed.- Default yank/del/paste buffer can be configured to be the Windows clipboard (special register "*" in vim)
- C-u, C-d, C-f and C-b are emulated as motions. This means they can be used to extend the current selection or as operator command arguments. There doesn't seem to be any loss in doing this way, there are definite advantages, and it't not easy to understand why they are not motions in vim - except C-u and C-d, which act as motions for visual selection extensions, but not for operator command arguments.
- Behavior when pasting over a visual-mode selection is slightly different from vim when the pasted register and the selected ranges are of different types. We think ViEmu's model makes a bit more sense, although none of the two models are a very useful editing operation.
- When repeating with '.' a command that operated on a visual motion, if the range was charwise, it is simulated keeping the line and column offset, in place of per character count. This usually makes more sense.
- Multi-line input (as invoked with 'I','A', 'C' or 'c' from visual-block selection mode) in vim doesn't work if deleting characters, joining lines or splitting them. ViEmu supports this in most cases (where it makes sense).
- Multi-line input supports counts for 'c' and 'C' commands as well, not just for 'I' and 'A'
- "Inner selections" by pairs of delimiter characters ("ib"/"i)"/"i(", "iB"/"i}"/"i{", "i>"/"i<", "i["/"i]") move the last character to the end of the previous line when the closing character is the first non-whitespace in its line. This is done by vim only for curly-brace blocks ("iB"/"i}"/"i{"), but not for the rest. It aids in being able to indent material between delimiters, and even if does not usually appear in C or C-like languages, it is equally useful for the rest of the delimiter pairs.
Limitations / things not emulated
We definitely intend to address these limitations in further releases of ViEmu. Please tell us which features you are more interested in.- vi-style abbreviations are not supported.
- [[,[],][,]] only search braces in column 0, not section boundaries as defined by form-feed characters.
- Sentence delimiters in ViEmu are '.', '!' or '?' *strictly* followed by either newline, space, tab, ')', ']', '"' or '"', apart from completely empty lines. vim supports a bit more flexibility.
- Block selections with a non-fixed-width font don't represent well when VS selection is used represent the selection. There are other inconsistencies here as well in the presence of folds or word wrapping. Using the custom-text-markers selection is recommended.
- "Virtual edit", that is, moving the cursor beyond end of line, is not supported.
- Auto completion in input mode does not support C-x line completion mode, and is based in Visual Studio's autocompletion rather than proper vim-emulation.
- CUA-style (regular Windows) shift+movement-key selection is not supported.
- % doesn't match C-style comment delimiters or preprocessor #ifdef's
- Actions in the undo list don't have descriptions
- ^J, ^N, and ^P bring up Intellisense autocompletion instead of filescan autocompletion.
- In overtype mode (such as with the R command), BACKSPACE does not restore the last character as vim, it erases it. This is required due to interactions with Intellisense.
- Numbered registers "0 to "9 do not "roll" like in vim, they are regular registers.
- Pasting over a visually selected region (p or P in VISUAL mode) does not copy the selection into any register
- Cursor positions after undo/redo are not the same as in vi/vim. This is due to VS's undo mechanism.
- ViEmu has only been limitedly tested with non-single-byte or non-left-to-right codepages. There are provisions in the code for these issues, but they are untested and unsupported as of now. No provisions have been made either for right-to-left or bidirectional text. The only feature is resetting the IME (if present) when leaving insert mode. Supporting these features is planned for future versions, and we would be glad to hear from you about how it works for you in this respect.
10. Support
Support is available via e-mail and on the support forums. You can write to support@symnum.com for any question. All inquiries are answered within two business days, usually much faster.The support forums are available at www.viemu.com/forums. Apart from support questions, frequent updated builds are announced there.
I try to address as promptly as possible any questions with installation or ViEmu, esp. fixing bugs in the software.
When reporting a problem, please try to provide general information about your system (OS, version of Visual Studio you are using, other installed add-ins, etc...), and as much information as you can about the context in which the problem appeared (last action performed, state of the sytem, etc...).
If you are not yet a registered customer, but you have found some problem installing or using the evaluation version of ViEmu, we will be glad to answer any question you send to the above support address.
11. Change log
ViEmu 2.5 (April 20 2010):
Version 2.5 consolidates all 2.2.x improvements, brings important new features, and implements the new Symnum licensing system2.2.2: 2.2.3: 2.2.4: 2.2.5: 2.2.6: 2.2.7: 2.2.8:
- Works better with Lua when Visual Assist X is present
- Fixes "100%" motion (including precise {n}% vim emulation)
- Better R# compatibility (detects R#-inline-rename mode by presence of VS marker, and auto-enters VS mode)
- Fixed {n}| motion behavior (was off by one)
- :ern[ext]/:erp[rev] commands to navigate errors
- New EXE-based installer, clearer, and better compatibility with Vista/Win7 UAC
- Implemented multiple-key chord mappings (:nnoremap end $), with ambiguity support, timeout, timeoutlen, etc..
- Implemented Ctrl-A/Ctrl-X command to increment/decrement numbers (or letters), also with 'nrformats' variable
- Implemented insert mode Ctrl-Y/Ctrl-E to copy character from line above/below
- Fixed bug: right after 'g' or 'z', normal mode mappings are not applied (technically it's in normal mode, but it's more like a parsing sub-mode)
- Fixed bug: made searching backwards actually work with /zs somewhere other than at the start
- Fixed bug: removed buffer from buflist (:ls) after closing it with :q, same as was done before with :bd
- Fixed bug: K did weird things in visual mode (moved to top), fixed (now it does nothing)
- Fixed bug: an empty o<esc> would not set the `. mark, now it does
- Fixed bug: improved compatibility when editing SQL files with VS 2008 Database Edition (cmdline editing issues)
- New licensing system
ViEmu 2.2 (July 14th, 2008):
Version 2.2 consolidates all 2.1.x improvements, and brings important new features, like vim 7's i'/a'/i"/a" motions text object motions:2.1.1: 2.1.2:
- Removed the warning when you try to paste in a read-only buffer
- Added user setting to remove "Read-only op" warning
- Removed dialog box when trying to paste in a readonly dialog
- :n, :N as synonims of :bn, :bp
- Made 'a or `a or :13 open folds
- Fixed the "ct<space>" problem when <space> is :mapped to something (changed order when determining current mappin context, lang-arg must come before op-arg)
- Fixed XML and HTML file interception in VS2005 if you hadn't opened a project (Visual Assist interaction)
- Fixed crash when searching for "/zs*" due to the 'incsearch' feature
- Made Ctrl-U in cmdline mode delete back to the start
- Made Ctrl-W in cmdline mode delete a word
- Made Ctrl-U in insert mode delete back to the point of insertion
- Made Ctrl-W in insert mode delete a word
- Removed "--NORMAL--" and similar modeline info when typing a search or an ex command
- Better emulation of vim's "vi undo mode"
- Addressed i_Ctrl-D differences with vim
- Fixed ViEmu crashing when enabling/disabling it, in VS 2005 with Service Pack 1, due to mishandling and empty removal-keybinding list
- Fixed crash in VS2005 under Vista, after doing a refactor, got minidump (crashed handling with the 'preview' window)
- Undo undid too much with Visual Assist and other VS actions
- Made :s show a message if nothing is found
- Added proper handling of keybindings in the Korean localized version of Visual Studio
- Added :ve[rsion] command to show the version and web address for ViEmu
- vj$:s/.../ woudn't work, said 'mark not set'
- Fixed wrapscan fails when searching exactly from beginning-of-file and end-of-file
- Return in XML files was non-functional when Visual Assist is present, fixed
- Made <c-v>i} always extend selection by changing cursor sanitization to allow EOL in non-chars visual modes
- Made the fold command create the outlining session if it doesn't exist
- Made zf move the cursor to the first char, regions weren't always being folded in VS2k5+
- Made :omap w iw work fine and not screw up "diw", "daw"... by applying it only at the first char after an op (like vim)
- Made gS only effect if last command in macro (or if stand-alone)
- Implemented gt/gT to go to next/prev buffer
- Fixed bufpos remembering when doing gt/gT/:bn/:bp
- Implemented gp/gP to paste and leave the cursor after the pasted text
- Implemented i', i", a', a" vim7 text-object motions
ViEmu 2.1 (February 26th, 2007):
Version 2.1 makes official the many fixes and improvements provided as maintenance releases since the release of 2.0:2.0.27:
- :noh[lsearch] implemented
- hlsearch setting wasn't honored on startup, even if it was shown fine in Tools|Options|Viemu
- The desired-cursor-col was not reset after moving the cursor by left-clicking
- :set gdefault would not work in .viemurc
- Pasting in VB would lead the language service into "partial" corrections and lead to syntax errors
- The /| operator in regular expressions didn't work fine (would only match the second branch)
- Keyboard management should now support the Japanese version of Visual Studio
- Ctrl-T/Ctrl-D in "virtual space" work fine (after o/O with autoindent)
- :bd now removes the buffer from the buffer list (it also closes the file if it's the current file, not if it isn't)
- <c-t> now invokes View.PopBrowseContext (poor man's tag stack pop)
- :set [no]remap implemented to disable all recursive mapping
- infinite mapping loops detected & cut (eg, :map n l and :map l n)
- visual block done by ^Q j $ now extends to the $ of each line
- dd on a single-line file (or dG from the 1st line in any file) would leave a dangling line, fixed
- Special marks '[, '] (last pasted/changed/yanked/etc... range) and '^ (last insert pos) added
- Added gi command, to go into insert mode at the last insert position
- Command line space much larger (it was read & processed, but not properly displayed)
- Yanking of column blocks with empty lines fixed
- Playing a macro from an empty register would crash VS (@a)
- Special marks '[, '] and '^, introduced in 2.0.30, no longer cause the insertion of VS marks when the relevant option is selected in Tools|Options|ViEmu.
- Crash when yanking/deleting a $-extended characterwise block fixed. This is after having added proper $-extended column block handling back in 2.0.28.
- AltGr keys in international keyboards (Swedish, Spanish, etc...) didn't work right in normal mode. Esp. the '@' command (AltGr-2).
- Changed the first-time keybinding removal logic so that it won't remove extra standard keybindings (backspace, ...)
- Made Ctrl-[ in international keyboards where '[' is not on the same key as on the US keyboard work as Esc again
- Fixed the '%' motion to start checking at the last character is the cursor is beyond the end of line (as vim)
- Some remaining problems of AltGr key combinations fixed for international keyboard layouts (not repeating AltGr characters with '.')
- Cursor position was not restored properly after many operations (dd, r*, etc...) - this was broken since 2.0.27
- Pasting over a linewise visual selection at end-of-file didn't work well
- Editing a long command line could result into a crash (only actually likely in versions before 2.0.32, where the buffer was small)
- '.' would stop working properly for input repetition after switching back and forth between two split views of the same file
- Crash that happened when exiting Visual Studio if no ViEmu-subclassed window had been actually used.
- Tabify/Untabify commands under Edit|Advanced wouldn't work
- gu/gU/g~ could get into an infinite loop when modifying lines with hard tabs while using soft tabs (or viceversa)
- Shift-Tab in insert mode fixed so that it does its usual VS operation, that is, it unindents the line and cursor position if the cursor is anywhere in the leading whitespace in the line (else it does nothing).
- :g and :s with use (when given an empty regex) and modify (in other cases) the 'last-search-string' as vi/vim, the same value used by n/N to repeat the last search
- Implemented :> and :< ex commands for indenting/unindenting a range of lines
- Implemented ":set [no]list" option, it toggles Visual Studio's "View Whitespace" setting
- Implemented ":set [no]wrapscan" (or ":set [no]ws") option, it toggles wrap-around behavior for searches
- The "Use VS Selection for visual mode" and "Windows-style word-wrap navigation" settings weren't honored on startup. They were persisted and read properly, and they'd make effect from the settings UI, but not when starting up VS again.
- Experimental support for CUA-style selection (Shift+Arrow Keys or Navigation Keys)
- Pasting a block at the end of the file would send the cursor up to the top of the file
- Fixed "//<return>" from creating a slow editing experience because of invisible zero-width markers inserted in between every two characters
- Vista compatibility
- Fixed problems when using 'r' in a $-extended visual selection
- Fixed highlighting of block visual selection when there were hard tabs in a line
- Motions i or a followed by one of {}<>[]bB now are adaptive linewise/charwise, as in vim
- Ctrl-] followed by Ctrl-O didn't return to the point before Ctrl-], but to the one before that (it failed only in intra-file jumps)
- When searching with '*' or '#', /<token/> is now added to user-typed search history (you can do /<up> and they'll be there)
- Fixed bug in "single-line" files (cursor doesn't move) - it's a VS.NET 2003 bug, but ViEmu made it more apparent
- Implemented ':set'/':set all' to show all the current settings
- The cursor sometimes wouldn't properly have its block shape since the first moment (hopefully fixed)
- gI (input at "hard" beginning-of-line - column 0) implemented
- The '[' character was not allowed in sets in regular expressions ("[[abc]" means any of a, b, c and '[')
- Fixed repetition with '.' of input including high-ascii characters (>127)
- v$ wasn't represented well when using VS selection for visual mode
- ESC now removes the status message in normal mode
- EULA updated to reflect the per-user license type (you could stay with the previous license, but this is just less restrictive)
- 5:s syntax and offset-ranges (:.,.+4s/...)
- Uppercase operators in :s subst string (/u /U /l /L /e /E)
- gd to go to local definition
- :u[ndo] and :red[o]
- " comments allowed in .viemurc
- 'v' in visual-chars, or 'V' in visual-lines... now exit visual mode
- HLSearch calculation made incremental, huge boost to the performance of hlsearch with large files
- Paste auto-reindent (]p)
- Searching with wrapscan doesn't enter folded #regions or outline folds
- IME reset when pressing ESC (useful when using Japanese and other Far East languages)
- /;<cr>i<cr> failed, second <cr> didn't work (ECMD_RETURN was cached disabled)
- Force undo grouping to be cut on buffer change (same as vim)
- :bd wouldn't work in the first buffer (All)
- :bd wouldn't work after closing a buffer with :bd and reopening it, if no other buffer got the focus in between (All)
- Find in Files could sometimes freeze if hlsearch was enabled (VS+SQL)
- The return key wouldn't work in the first opened buffer if Visual Assist is installed (VS)
- Fixed another edge case in Visual Assist interaction, which would prevent Return from happening in VS2005 (can also happen in VS.NET 2003, but it's less likely).
ViEmu 2.0 (September 20th, 2006):
ViEmu 2.0 is in many senses a re-implementation, based in a new vi/vim emulation core. A much more advanced integration framework has also been developed. The main new features are the following:- 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-n> <down>", ":map // /xkz<esc>"...)
- Buffer number commands - :ls, :b[uffer] <n>, :bn[ext]/:bp[revious] with these numbers
- Proper wordwrapping support, better and faster folding support
- Better incremental search (works also in visual mode)
- Macros stored in regular registers (use qa to record a macro and paste the contents with "ap)
- 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] and :wqa[ll] command
- :vsc[md] command
- Count support for the | motion
- gJ command implemented
- gS command implemented
- zR fixed
- J/:j joins fixed to work as vi/vim (inserts a single space)
ViEmu 1.4 (November 25th, 2005):
New features added:- Visual Studio 2005 support
- ":wa[ll]" to write all files
- "gf" to open the file under the cursor
- "gq" operator to reformat code (via VS's autoformatting mechanism)
- "=" operator (same as gq)
- "|" motion to go to beg-of-line (same as '0')
- "%" allowed in non-pair characters - it scans for first one, then jumps from that one
- Ctrl-R recalls the contents of a register at the command line or in insert mode (as in vim)
- :macro command implemented: it allows running a Visual Studio macro from the ex command line
- 'yy' doesn't move the cursor to the beginning of the line any more (similar with other motions for yank)
- The 'immediate' command window and the 'find results' windows are no longer overtaken by ViEmu
- The cursor now gains block shape as soon as a window is open
- Mouse selection after end-of-line now works fine
- ZZ command implemented (same as :wq, save and quit)
- Visual Studio's messages on the status bar aren't overridden so often
- No querying about "backwards range given" when a visual selection is made upwards and an ex command is applied over that
- /<ENTER> and ?<ENTER> now properly repeat the last search (was broken in 1.3)
- Cursor position after linewise paste is now correct
- New settings: 'smartcase' and 'remove-vs2005-readonly-warning'
- MessageBoxes from ex command errors converted to status bar messages
- 'N lines yanked'/'N more lines' messages for yank/paste commands
- :set [no]viu[ndo] to revert to single-undo as in the original vi
- Ctrl-HOME/Ctrl-END now work.
- */# now act as if 'smartcase' weren't set, as in vim, so that it acts only along the current 'ignorecase' setting.
- Implements '/r' in the :s replacement string to insert a newline (multi-line matches were supported, but not multi-line replacement strings)
- <RETURN> now goes to the first non-blank character of the line below
- Ctrl-N/Ctrl-P work properly both in normal and insert mode
- '/<RETURN>' and '?<RETURN>' properly update the search direction for further n/N motions.
- Basic :map/:unmap support which works only with single-character to single-character mapping
- ViEmu scans its installation folder at startup for a '.viemurc' or '_viemurc' file, and executes it if present (only :set/:map/:unmap actually do anything there)
- New ex commands :prb[uild] and :qa[all]
- Ctrl-Y to yank the command line
- Behavior of the END key slightly altered to fix an interaction problem with Workspace Whiz
- Fixed input of Cyrillic text (and possibly others)
- Fixed T and F motions range when used as operator argument
- Fixed '' and `` so that they never jump between buffers, as vim
- Added experimental VS.NET 2002 support
- Implemented message 'N substitution on N lines' for :s
- Added a DLL to the package which prevented ViEmu from loading in some circumstances
- Fixed a problem when performing a :'<,'>s with the region going to the line before last
- Fixed a bug resulting in 'smartcase' and 'remove-read-only-warning' preferences not being honored at startup
- Prevented Intellisense from kicking in when using BACKSPACE in either VISUAL or NORMAL modes (it was causing trouble with VB)
- Made ViEmu check $HOMEDRIVE/$HOMEPATH and $HOME for the .viemurc or _viemurc file before checking the installation folder
- Implemented :cn/:cp, although they only work properly if the output window is 'pinned' (that is, it doesn't slide out of view automatically).
- Fixed cursor position after ^N/^P autocompletion
- :ta[g]
- ^W<Up>/<Down> to switch windows
- HOME now jumps to the hard beginning-of-line
- Ctrl-Shift-Alt-V globally toggles ViEmu on/off
- g*/g# search for the identifier under the cursor, down and up, w/o requiring a full-word match
- Implemented Ctrl-^ to switch to the previous buffer
- :set [no]incsearch/[no]is support
- CodeRush compatibility plugin implemented
- ^Wc and :clo[se] to close the current window/file
- Y in visual mode now returns to normal mode
- "INSERT --" is now "-- INSERT --" as in vim
- Cursor now updated after :d
- Block cursor not lost with some operations
- Undo/redo now should properly restore the cursor pos in all operations
- :f[ile] command
- New Welcome/Trial dialogs, and more links in Tools|Options|ViEmu
- Resharper compatibility: included code to enter insert mode automatically when an inline 'Rename' command is launched
- Visual Assist compatibility: included code to detect Visual Assist and guarantee proper order of editor window subclassing
- Visual Assist compatibility: included code to return from insert mode when pressing ESC even if Visual Assist has a drop-down opened
- Visual Assist compatibility: added :set [no]vax[esc] option to govern the behavior in the previous point
ViEmu 1.3 (November 5th, 2005):
New features added:- gv command: gets back into visual mode with the last visually selected range and range type
- '< and '> marks store the beginning and end of the last visual selection
- Command line editing with history for '/', '?' and ':' commands
- ex emulation: :set, :d[elete], :y[ank], :j[oin], :pu[t], :co[py]/:t, :m[ove], :p[rint], :nu[mber]/:#, :s[ubstitute, :&, :g[lobal] and :v[global]
- Regular expressions in search motions ('/' and '?') and ex commands
- & command in normal mode
- The following :set params work: [no]magic, [no]ignorecase, [no]smartcase
ViEmu 1.2 (September 29th, 2005):
New features added:- Folding support:
- Cursor skips over collapsed folds when using 'j' and 'k' (the rest of the motions open the fold)
- zf{motion} creates a fold for the enclosed text (works also directly in visual mode)
- zd removes the current fold (not the text, but just the fold markers)
- zR expands all folds
- zM collapses all folds
- zc, zo, za and zA toggle the current fold from open to closed, or viceversa
- Windowing support:
- ^Ws splits the current window if it's not already split
- ^W^W, ^Ww, ^Wj and ^Wk toggle between the two panes of the current file
- If you issue :q and the current view is a split, the split is removed instead of closing the file
- Other:
- Special mark `` (or '') to jump to the last jumped-from position (allows toggling back and forth)
- '@@' to re-play last played macro
- Now the result of incremental search (with '/') is shown with selection (except in visual mode)
- :s[ubstitute] brings up the VS Replace dialog (poor man's :s)
- :bui[ld], :comp[ile] and :deb[ug] commands
- Fixed problem in position history which would sometimes require pressing Ctrl-O twice to go back
- Fixed cursor positioning issue when repeating an 'o' or 'O' command
- Counts applied to 'o' and 'O' now work properly
- Much improved multiple-line input repeating with counts, '.', block-visual multi-input and within macros (also TAB)
- Count given to 'R' command is now honored (it was ignored)
- Any two-key motion started with 'g' could not be used as an operator (eg, 'dge'). Fixed.
- Made position-history aware of external file change events (such as Ctrl-Tab or clicking on the solution explorer or error window)
- Fixed 'r' inserting spurious naked LF's when given RETURN as argument, now it correctly inserts the appropriate terminator
- Both soft and hard TABs properly implemented in replace mode (for better integration with other tools and Intellisense, done along VS's conventions, not vims)
- Repeating input wich involved overstrike mode changes during input now works properly
- Now BACKSPACE and SPACE wrap around end of line, as in vim
- Fixed position history problems with unnamed files (both "Find results" window and just-created unnamed files)
- Made ESC in normal mode beep, as in vi/vim
- "Desired cursor column" is now updated after repeating input, as in vi/vim
ViEmu 1.1 (August 18th, 2005):
Bugs fixed:- "Find in Files" would often freeze when reaching a file edited with ViEmu
- Text input during macro recording was not properly re-input when playing back
- A '.' command involving line entry in indented lines at end of file did not work well
- Deleting a character range in the last line moved the cursor to column zero
- The count in the 's' command applied to the input repetitions, should apply to the # of chars erased
- '/' without arguments didn't do anything, now it properly repeats the last search forward
- 'o' or 'O' with a count did not repeat the NewLine operation, only the text input
- ViEmu now intercepts all text editing windows, this provides for better integration in all cases
- Ctrl-SPACE and Ctrl-Shift-SPACE did not bring up autocompletion/method info in insert mode - now insert mode is quite similar to regular Visual Studio editing and supports these as well as many other shortcuts
- Mark positions and position history (Ctrl-I/Ctrl-O) are now correctly updated during editing, so they remain tied to the original text where they were set
- ViEmu now hooks Visual Studio's editor in a way that allows proper compatibility with other editor-enhancement add-ins
- Added the Ctrl-] command to jump to a symbol's definition
- 'o' and 'O' now perform correct automatic indentation
- Added an option to enable/disable ViEmu
- Ctrl-T/Ctrl-D in insert mode to indent / unindent the current line