This extension provides basic support for Emacs keybindings and text editing commands, very similar to thebuilt-in Emacs keyboard layout in VS 2008. Once the extension is installed you should be able to use familiar keyboard shortcuts to execute Emacs commands within VS 2010.
Installation and Setup
Installing Emacs Emulation requires Visual Studio 2010 Pro, Premium, or Ultimate (the Express editions do not support extensions) and a one-time elevation to administrator permissions. This elevation is necessary to install the keybindings file in the Visual Studio Program Folder. The first time you launch Visual Studio after downloading and installing the extension, you should see a permissions dialog, shown below. Click OK and follow the system prompt to elevate. This is only required once; subsequent launches of Visual Studio will not prompt for elevation.
After installing the extension and keybindings file, go to Tools->Options->Keyboard to select the Emacs keyboard mapping scheme, as shown below:
Using the Emacs Keyboard Layout
You can begin using Emacs shortcuts as soon as you’ve selected Emacs as your keyboard mapping scheme. Some of the most common Emacs shortcuts supported by this extension are:
General Shortcut Keys
ALT + X
Places the cursor in the Find/Command box on the Standard toolbar.
SHIFT + ALT + 5
Displays the replace options in the Quick tab of the Find and Replace dialog box.
ALT + Y
Pastes an item from the Clipboard Ring tab of the Toolbox to the file and automatically selects the pasted item. Press ALT + Y again to paste the next item to theClipboard Ring.
CTRL + G
Stops the current command or code and deactivates the region.
CTRL + U
Prompts for an integer, returns negative if the first character entered is a hyphen. When a non-digit character is entered, the prefix for the command is set to the entered integer. If no integer is entered, the default value is 4. Repeatedly invoking the command multiplies the current value entered by the previous accumulated value.
Inserts a new line.
CTRL + J
Inserts a new line and indents it.
CTRL + T
Transposes the characters on either side of the cursor. For example, Ed|n Sub would be changed to read End| Sub.
CTRL + DELETE
Deletes the current selection.
CTRL + K
Deletes from the cursor to the end of the current line.
CTRL + O
Inserts a new line after the cursor. The cursor stays in the current line.
CTRL + Q
Reads another key and inserts the key into the buffer. Keys must be 8-bit ASCII characters. Use this command to insert control characters, meta characters, or graphics characters into the buffer.
ALT + C
Capitalizes the character to the right of the cursor or the first character of the next word if the cursor is between words.
ALT + D
Deletes the characters to the right of the cursor to the end of the word.
ALT + BACKSPACE
ALT + DELETE
Deletes the characters from the left of the cursor to the start of the word.
ALT + L
Changes the selected text to lowercase characters.
ALT + T
Transposes the words on either side of the cursor. For example, |End Sub would be changed to read Sub End|.
ALT + U
Changes the selected text to uppercase characters.
CTRL + B
Moves the cursor one character to the left.
CTRL + F
Moves the cursor one character to the right.
SHIFT + ALT + . (period)
SHIFT + END
CTRL + X, ]
Moves the cursor to the bottom of the current document.
SHIFT + ALT + , (comma)
SHIFT + HOME
CTRL + X, [
Moves the cursor to the top of the current document.
ALT + G
Displays the Go To Line dialog box, which allows you to navigate to a specific line of code in the current document.
CTRL + N
Moves the cursor down one line.
CTRL + E
Moves the cursor to the end of the current line. If you use word wrap, the cursor moves to the physical, not the displayed, end of the current line.
CTRL + A
Moves the cursor to the beginning of the current line. If you use word wrap, the cursor moves to the physical, not the displayed, beginning of the current line.
CTRL + P
Moves the cursor up one line.
CTRL + X, CTRL + SPACEBAR
CTRL + X, CTRL + SHIFT + 2
Moves the cursor to the current mark and then removes the mark for the location stack.
CTRL + L
Scrolls the document so that the current line is now in the center of the viewable area in the editor.
SHIFT + ALT + 1
Scrolls the document so that the current line appears at the top of the viewable area in the editor.
CTRL + V
Scrolls down within the document.
ALT + V
Scrolls up within the document.
CTRL + SHIFT + 2
CTRL + SPACEBAR
Adds a mark to the location stack for the current cursor.
CTRL + X, CTRL + X
Moves the cursor to the current mark in the location stack and moves the current mark to the location where the cursor mark was when the command was invoked.
CTRL + RIGHT ARROW
ALT + F
ALT + RIGHT ARROW
Moves the cursor to the first character in the next word.
CTRL + LEFT ARROW
ALT + B
ALT + LEFT ARROW
Moves the cursor to the first character in the previous word.
CTRL + X, S
Displays a list of modified files and allows you to select which files to save.
CTRL + X, 1
When a window is split, this shortcut closes the pane that does not have focus.
CTRL + X, O
Switches focus between panes when a window is split.
CTRL + X, 2
Splits the current document in half vertically. The current line of code is centered in each window.
Using the Emacs Commands
Once you’ve installed the Emacs Emulations extension, all of the Emacs shortcuts it enables are fully customizable. If you choose to use the Emacs keyboard schema, you’ll automatically get the shortcuts listed above. If you don’t like a particular keybinding in the Emacs schema, you can always change it through Tools->Options->Keyboard. You can switch keyboard layouts or customize shortcuts for specific commands (Emacs or otherwise) at any time.
- Cut/copy/paste from other applications into Visual Studio does not work with the Emacs extension installed. We're working on a fix for this issue and will post an updated version of the extension when a fix is available.
- Tab-Tab will not complete code snippets. We're working on a fix.
- Tab will sometimes delete text when pressed at the beginning of a line. As with the first two points, we're working on a fix.
- The Emacs extension will not become active until a project or solution is opened. We would love to remove this restriction, but unfortunately that would cause performance to drop significantly.
- FIXED in currently published version: Pressing Tab on a blank line will not add the proper indentation. The workaround is to add text to the line and then press Tab.
- FIXED in currently published version: Pressing Tab when Intellisense Statement Completion is active will not complete. The workaround is to use another completion character or Enter to commit.
We’re always interested in your feedback on Visual Studio and extensions published by Microsoft. In fact, this extension was created largely in response to your feedback that removing Emacs emulation from VS 2010 was causing significant pain on a daily basis; we hope we’ve addressed that pain with this extension. If you have questions or comments about Emacs Emulation, feel free to post them in the Q&A section here. If you find a specific bug in Emacs Emulation, please file a Connect bug report so we can investigate in more detail.