George V. Reilly's Technical Blog

ViEmu: a vi and Vim emulator for Visual Studio

Vim vs. Visual Studio

I've been an obsessive vi user for more than 20 years. Vi keystrokes are indelibly burned into my muscle memory. When I have to use Notepad or Word or Visual Studio, I feel crippled. I have to work harder to do simple things; I have to type too many chords with Alt and Ctrl; I have to take my hands off the home keys to use the cursor keys and the mouse.

In the mid-90s, I adopted Vim (Vi IMproved) to the point where I became a significant contributor, writing a big chunk of the Win32 code.

While I was at Microsoft, I hardly ever used Visual Studio. I edited my C/C++ code with Vim, I compiled and linked it with the NT Build Environment and I debugged it with WinDbg/ntsd/kd. I was hardly alone in this. In the Windows division, your code has to build with the NT build environment, and the Windows debuggers are much better supported than the Visual Studio debugger for developing the OS.

Now that I'm programming in C#, using the Visual Studio IDE makes a lot more sense. VS's IntelliSense for C# is much richer than Vim7's Omni completion, especially when coupled with ReSharper, and VS is the debugger of choice for managed code. I've been spending a fair amount of time in the VS IDE, especially when pair programming, but I've also been switching back to Vim a lot. When I'm struggling with unfamiliar code, VS's IntelliSense is a great comfort; when I'm moving a lot of text around, Vim suits me far better.

ViEmu

Earlier this week, by way of its graphical Vim cheat sheet, I found an interesting compromise. ViEmu is a vi/Vim emulator for VS 2003 and VS 2005.

ViEmu implements most of the vi keystrokes and many of the Vim extended keystrokes, right inside the Visual Studio IDE. It uses the native VS IntelliSense in place of Vim's completion functions. ViEmu even implements some of the more common Ex command line, including most of the :%s regular expression substitutions. The author, who seems to be known only as JNG, is responsive. Within 24 hours of my reporting some missing keystrokes, he had implemented them in a new minor release.

It does not, however, support VimL, the Vim extension language, so if you have an extensive suite of Vim plugins, as I do, they're not going to work in ViEmu.

All in all, I'm favorably impressed with ViEmu. It provides much of the muscle memory experience of Vim inside of Visual Studio. Technically, it can't have been easy to impose such a radically different input model on VS or to emulate Vim and Ex fairly faithfully.

Vim has always been free (actually charityware), but JNG charges for ViEmu. Right now, I'm in the 30-day trial period, but I fully expect that I'll pay for a license before the trial is up.

VisVim

Vim comes with a Visual Studio add-in called VisVim, which is based on another add-in called VisEmacs. It allows VS5 and VS6 to use Vim as the default editor, albeit externally to the IDE: Vim continues to run in its own window.

A few weeks ago, Bram asked me if I could get VisVim to compile with VS 2003. I tried, but I was unable. Necessary headers are no longer included with VS 2003 or VS 2005. No doubt this is because the Add-In architecture changed radically with the introduction of Visual Studio .NET.

Work is underway, albeit very slowly, to create VisEmacs.NET. At some point, it may be worth creating a merger of VisVim and VisEmacs.NET.

End Notes

viWord allows you to use vi keybindings in Microsoft Word. It's not nearly as full featured as ViEmu and I found that I didn't like it enough to keep it around.

This post was, of course, composed in Vim. I wrote it in lightly marked-up plain text and converted it to HTML with VST, Vim reStructured Text. Blogging with VST will be the topic of a future post.

To fully take advantage of Vim7's Omni completion, you need a patched version of Exuberant Ctags. I've made a Win32 binary available.

Posted: Apr 08 2006, 08:47 PM by george_v_reilly | with 11 comment(s)
Filed under:

Comments

Davyd McColl said:

Wow, $79 isn't a trivial price where I'm from. I'll just have to keep an eye on vivs... Sean Paul: here's hoping you get somewhere with that!

# April 15, 2008 9:11 AM

tom said:

do you have any recommendations for intro material on using vim to with nt/windbg for general development?

# May 12, 2008 10:55 PM

Ronald Duncan said:

ViEmu has a nice developer and continues to develop.

However VIM is just awesome, and it is really frustrating to not have the full power of VIM in Visual Studio.

However, the balance of ViEmu which has the core functionality, with Resharper etc, means that I am using ViEmu.

Though, I am using VIM and the SQL plugin for SQL development along with the ViEmu plugin for SQL Studio.

# August 13, 2008 2:41 PM

David Miller said:

Thanks for this interesting post on Vim vs. Visual Studio. It was most enlightening and I had shared it with my development team.  

# March 17, 2010 9:26 AM

hbo ipad app said:

Never, never, never, never give up

-----------------------------------

# December 22, 2010 7:11 AM

ipad reviews said:

It's great to be great , but it's greater to be human.

-----------------------------------

# December 24, 2010 12:02 PM

ipad application said:

-----------------------------------------------------------

"Come on dude, these facts* and proof* i necessarily mean who's posting* lol :P"

# January 4, 2011 7:07 PM

Easton said:

Thanks for finally writing about >ViEmu: a vi and Vim emulator for Visual Studio - George V. Reilly's Technical Blog <Loved it!

# August 7, 2012 5:13 AM

Melton said:

Its such as you read my mind! You appear to understand

so much approximately this, like you wrote the e book in it or something.

I feel that you just could do with a few p.c. to force

the message house a little bit, but other than that, this is great blog.

A great read. I will definitely be back.

# February 6, 2013 11:05 AM

Correa said:

It's awesome designed for me to have a site, which is good in support of my know-how. thanks admin

# February 15, 2013 2:15 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)