Share via


Emacs Commands – Extension #10

Use your Emacs commands once again!

If you have opened the Tools – Options – Keyboard page, looking for the “Emacs” keybindings, but only found disappointment instead.

Emacs in keyboard scheme options

This extension is for you!

To Install

https://visualstudiogallery.msdn.microsoft.com/en-us/09dc58c4-6f47-413a-9176-742be7463f92

To Use

In order to finish the installation, you must open/create a project. This will prompt you for elevated permissions to finish installing the Emacs.vsk file (the emacs keyboard shortcut file) to the Visual Studio IDE folder located under Program Files (hence the elevated permissions since you need to be an admin to get in here on the file system).

image

Once a project is opened, you’ll see the Emacs item in the Tools – Options – Keyboard scheme dropdown.

Emacs in keyboard scheme options

Quick Primer on Emacs

For those new to Emacs, here’s a quick example how it works in Visual Studio. (This is the way Emacs was explained to me 10 years ago.)

The “big” key is the Alt key.

The “small” key is the Ctrl key.

If you want to navigate forward, just letter by letter, you press Ctrl+F (small Forward). If you want to navigate backward, just letter by letter, you press Ctrl+B (small Backward).

If you want to navigate forward, word by word, you press Alt+F (big Forward). If you want to navigate backward, just letter by letter, you press Alt+B (big Backward).

My favorite part of using Emacs was the ability to move up and down without having to reach for the arrow keys (Ctrl+U, Ctrl+D).

Uninstall

I’m calling out the uninstall because it looks like when you disable or even uninstall the extension, the Emacs option still remains selected in the Tools Options Keyboard list. You must go back to Tools Options Keyboard and select the “(Default)” keybindings.

Selecting Default on the keyboard mapping scheme

Since it required admin rights to add it, you’ll need admin rights to remove it. And i’m guessing if the extension waits until a project is opened to prompt you for these permissions, there isn’t a place for the extension to prompt you to remove the .vsk file. (you can’t be prompted the next time you open a project because the extension is gone.) But that’s just my guess.

If you forget this step, you’ll notice a great many things not working, like Ctrl+F. Since in the Emacs keybindings that’s bound to a command that no longer exists in VS, you’ll won’t see Quick Find dialog. Simply go to Tools Options Keyboard and select Default, and VS will be right as rain.

You can always manually delete the Emacs.vsk file yourself at your own risk.

More Information

You can find more information on all the Emacs keyboard shortcuts supported by the extension at the bottom of this post.

https://visualstudiogallery.msdn.microsoft.com/en-us/09dc58c4-6f47-413a-9176-742be7463f92