Emacs Keybindings in Visual Studio 2012 or 2013
Visual StudioEmacsVisual Studio-2012Key BindingsVisual Studio Problem Overview
I would prefer to have Emacs keybindings in MSVS. In MSVS 2008, this was natively supported, and in MSVS2010 there was an extension to achieve this
http://blogs.msdn.com/b/visualstudio/archive/2010/09/01/emacs-emulation-extension-now-available.aspx
Can i install this extension in MSVS 2012? (I have thus far been unsuccessful...) Is there another way to achieve Emacs keybindings?
Visual Studio Solutions
Solution 1 - Visual Studio
I figured out how to get the emacs emulation extension for VS 2010 to install and run on VS 2012. This is a bit from memory, but here is what I did.
-
Download the Emacs emulation extension.
-
Rename it from EmacsEmulations.vsix to EmacsEmulations.zip and unzip into a folder.
-
Edit the
<VisualStudio Version="10.0">
value on the extensions.vsixmanifest file (XML):Pro
Note: Visual Studio 2013 works by setting Version="12.0"
. And VS Express can be used by setting <Edition>Express_All</Edition>
-
Zip the content inside the folder back up and rename it back to EmacsEmulations.vsix.
-
Run the vsix file as administrator. This is required so the extension can write Emacs.vsk into the program files folder. I wasn't sure the best way to do this so I ran a command prompt as admin and then executed
start emacsemulations.vsix
from the prompt. -
Start VS 2012 as Administrator (one time only). At this point, the extension should show up as installed in the extension manager and the keybinding should be listed in
Tools/Options/Keyboard
. Select the emacs keybindings. -
At this point it should be working. It wasn't working for me though, but I neglected run step 5 as admin so had to manually copy emacs.vsk into the right spot. When it still wasn't working I brought up the VS command window (Windows/Other Windows/Command Window) and typed Edit.EmacsBreakLine and the prompt and voila.
I don't have any more information than that so YMMV. Good luck!
Solution 2 - Visual Studio
FYI: The emacs emulation extension is now open source.
Solution 3 - Visual Studio
If you want to make it work with the Express editions of VS2013, be sure to also change the Edition line to <Edition>Express_All</Edition>
. See also the description of the Edition element.
Solution 4 - Visual Studio
Jaket's method worked for me initially but stopped working after a few days. After searching for a solution in desperation, I then found XKeymacs [1] through a blog entry [2]. XKeymacs adds keymacs style keybindings to the entire windows environment, and works in Visual Studio as well. It might take some getting used to (e.g. Ctr-T doesn't work in IE anymore), but I am very happy being able to use emacs keybindings everywhere :)
Solution 5 - Visual Studio
I don't believe all of the steps in the accepted answer are correct. Instead:
- Follow 1-4 as above to produce a suitable
EmacsEmulations.vsix
file. - Install the extension as the user who needs the bindings and not as administrator.
- Manually copy the
Emacs.vsk
file from the unzipped content of the extension to theCommon7\IDE
folder in the Visual Studio program directory (for which you will need elevated permissions).
Running the extension as administrator will not achieve the desired file copy, nor will it allow other users to successfully use the new key bindings.
Solution 6 - Visual Studio
The trick that worked for me was to copy the Emacs.vsk file to the:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE>
directory. Somehow when I first installed it, it had gotten copied to the
C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE>
directory
Solution 7 - Visual Studio
To install the EmacsEmulations.vsix file for Microsoft Visual Studio Community 2015 (which reports its version as 14.0), there is an installer tool, VSIXInstaller.exe, in the folder:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE>
After modifying the vsix file as per above (inserting version "14.0" and edition "Community" in my case), the following worked for me from an admin command line (fill in your own full paths):
VSIXInstaller.exe /a EmacsEmulations.vsix
Note that after selecting Emacs in the keyboard mapping drop down in Tools/Options/Environment, the change didn't seem to take right away. I restarted Visual Studio and it didn't take yet either.
I then searched for installed key bindings with "emacs" in the name and they were there. Seemingly after that they were then active in the editor, so I'm not 100% sure what it was that triggered the activation.