The official source of product insight from the Visual Studio Engineering Team
We are pleased to announce the availability of Emacs Emulation as a free extension for Visual Studio 2010! This extension provides basic support for Emacs keybindings and text editing commands, very similar to the built-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.
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:
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 the Clipboard 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 —or— 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.
END —or— SHIFT + ALT + . (period) —or— SHIFT + END —or— CTRL + X, ]
Moves the cursor to the bottom of the current document.
HOME —or— SHIFT + ALT + , (comma) —or— SHIFT + HOME —or— 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 —or— 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 —or— 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 —or— ALT + F —or— ALT + RIGHT ARROW
Moves the cursor to the first character in the next word.
CTRL + LEFT ARROW —or— ALT + B —or— 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.
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.
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 blog comments here. If you find a specific bug in the Emacs Emulation extension, please file a Connect bug report so we can investigate in more detail.
Brittany Behrens Program Manager, Visual Studio Editor
Thank you -- this extension was literally the deciding factor between staying with VS2008 and upgrading to VS2010, which I have now done!
One thing you might want to add to the documentation: the extension does not work until a solution is opened. I installed the extension and launched VS2010 but it did not give me the priv. esc. dialog, and did not offer Emacs in the list of keyboard bindings. I uninstalled and reinstalled several times, restarting VS2010 each time, with no luck. Finally I tried opening a solution and I got the dialog box. Emacs then appeared in the list of valid key bindings, but switching to Emacs mode had no effect. I shut down and restarted VS2010 one last time and now everything works as expected.
Is it possible to copy-paste from another program into VS?
@uscjeremy: The fact that the extension doesn't kick in until a solution is opened is intentional. We would love to remove this restriction, but unfortunately that would cause performance to drop significantly. I will add this to the known issues section on the VS Gallery page, though.
@Elyseum: It certainly should be; the fact that this doesn't currently work is a known bug. We have a tentative fix and are working on publishing an updated version of the extension that allows copy-paste from other applications into VS.
Thanks for posting!
Is there a Brief Emulation extension coming soon? That's the one thing keeping us at VS2008.
@Mark McGregor: Unfortunately no. We're not working on a Brief emulation extension and don't currently plan to create one. Although usage numbers aren't the only factor we consider, the Emacs user base dwarfs the Brief user base even among the relatively small percentage of VS customers who use emulations. I truly wish we could include everything that was available in previous versions, but unfortunately it's not always possible.
I'm really looking forward to the Tab issue being fixed. It's very frustrating to be cruising along and then suddenly realize that some code somewhere has been erased by my habitual use of the Tab key.
One issue is indeed the tab issue.
Another one equal annoying is the following: In emacs when you select a couple of characters and you start to type, the selection is deleted. This doesn't happen with the emacs emulation mode.
The same happens with the del or the backspace: only one char is deleted and not the whole selection.
But thanks in any case for the emacs support
I also wish there was a Brief emulation. I go back and forth between SlickEdit (whose Brief emulation was always superior to VS2008) and the editor in VS2010.
Add VS functionality to Emacs and your training will be complete, young Jedi.
Emacs emulation is absolutely awesome, thanks so much for adding it. It really makes VS so much more usable for me.
The paste problem is a bit of an issue, though. I find myself copying and pasting code from the web quite often. Any word on when it might be fixed?
In the meantime, has anyone found an efficient workaround?
What does it mean that it is "fully customizable"? I can only see a dialog for changing the keybindings, but it does not allow me to define new functions. I see that C-u is universal-argument, but there is no digit-argument on C-1, C-2, etc.
Also, When I hit C-s it does not do incremental search-- isearch-forward is essential for quickly finding things in a document (and isearch-forward-regexp is even more useful).
And whenever I hit the meta key it makes the Start menu open. In fact, I don't see anything bound to a meta key in your list above, so does that mean that functionality does not exist? There are some pretty basic editing features that by default are bound to meta keys like M-h for mark-paragraph, M-( for insert-parentheses, and so on. Also, for some reason some things that should be bound to the meta key are instead bound to the Alt key which is very confusing since M-v should scroll the page down, not A-v.
This is very frustrating.
I love the Emacs functionalities in VS2008 and just wish to be able to use the same in VS2010 as well. How come the extension for VS2010 is so hard to implement now? It is fully bugged as I can read here, but one major issue has stopped me totally from using it. The issue with TAB when trying to indent lines rapidly must be fixed soon. It's very annoying that it deletes the current line you want to indent and makes the whole extension useless. I really hope you get this fixed soon. Any updates on this?
Unfortunately our dev team has already made the decision to move to VS2010 and I've just discovered that there's no Brief Emulation support. This is a disaster!
We have an entire department stuck at VS2008 because of the lack of Brief in VS2010.
Peter/Others with issues with the tabbing - hopefully you read this. As a brute force hack around the tabbing issue I created a quick macro to do this properly:
It's a tiny bit slower, but at least it doesn't delete!