Welcome to MSDN Blogs Sign in | Join | Help

jaredpar's WebLog

Code, rants and ramblings of a programmer.

Syndication

News

Now Reading

Expert F#

What's a better book to read when learning F#?

Essential WPF

Thus far the best book I've read on WPF. Gets right down to working with WPF and the goals/history.

Purely Functional Data Structures

Reading this book makes me feel like I'm back in college. It will really get your mind going and is best read with a whiteboard handy.

Blog Roll

Eric Lippert
Dustin Campbell
Jon Skeet
Coding Horror
Brian McNamara
Brian Bondy
Hub FS
Full List

Vim Emulator Editor Extension Released

I just released version 0.5.0 of VsVim: a vim emulation editor extension for Visual Studio 2010 Beta1 written in F#.  This is a hobby project I’ve been working on for awhile now.  I expect to continue updating this release as time goes on as I use it on a daily basis and I’m interested in getting back feedback from users on it.  

Link: http://visualstudiogallery.msdn.microsoft.com/en-us/59ca71b3-a4a3-46ca-8fe1-0e90e3f79329 

Here’s a quick break down on the state of this project

Caveats and Expectations

This extension is being released by me, not by Microsoft.  As such the support level for this extension is equivalent to the amount of free time I have to put into it. 

Quality Level

I would classify this as a Beta style release.  I use this extension every day and I have a very large test bed to verify functionality.  There are still several known bugs (detailed below) and little quirks I’m working on.  But they are mostly minor issues

What’s Implemented

At this point the engine has an Insert, Normal and Command mode. 

  • Insert Mode
    • Basic insertion layer which allows for typing.  No special insert mode commands are implemented
  • Normal Mode.
    • Movement Commands: h,j,k,l,w,b,$,^,n,*,#
    • Edit Commands: x,X,d,p,P,A,u,<,>,o
    • Incremental Search
  • Command Mode
    • :e
    • Jump to line
    • Beginning / end of line

Deviations

The biggest deviation I made from a traditional VIM engine is that I am using .Net regular expressions instead of VIM style regular expressions.  This allowed me to focus on getting a lot of features written vs. spending time building a regular expression engine.  Getting this working will be a focus of a later release. 

Another issue is the cursor.  As flexible as the new editor is, one part that is very tricky is changing the appearance of the cursor.  So making a block style cursor for normal mode was not done for this release.  Instead I simply color the cursor red for normal mode and black for insert mode.  This will be fixed in a later release.

Bugs

Below is the list of known issues for the extension.  I’ve noted all bugs for which I cannot get a steady repro.  If you can find one I would appreciate you emailing the steps to me. 

  • Cursor appearance in normal mode is not a block cursor but instead a red cursor
  • Need Repro: Using ‘o’ in normal mode can cause the line ending to switch from \r\n to \r or \n.
  • Both ‘#’ and ‘*’ match partial words instead of full words
  • Register list is limited to standard a-z alphabet

What’s next?

Thus far I’ve been working on features which don’t conflict with existing Visual Studio key bindings.  The next big release will be focusing on the infrastructure needed to integrate these commands smoothly into the core Vim engine and Visual Studio itself.  This will allow me to expand the number of implemented features a great deal. 

Where’s the source?

Should be released soon.  Right now I’m working out where I should host this project long term.  Preferably a place where users can file bugs and leave feedback. 


 

Published Tuesday, September 08, 2009 10:09 PM by Jared Parsons

Filed under: ,

Comments

# re: Vim Emulator Editor Extension Released @ Wednesday, September 09, 2009 2:30 AM

Nice!!

Kirill Osenkov

# re: Vim Emulator Editor Extension Released @ Wednesday, September 09, 2009 7:23 AM

Awesome, I can't wait for VS 2010 now. Personally, I would be happy with the .NET regular expressions. If I'm going to be programming in a .NET language reinforcing the syntax for the .NET engine makes sense for me.

Richard

# re: Vim Emulator Editor Extension Released @ Wednesday, September 09, 2009 10:10 AM

This is pretty interesting.  I wrote a VIM extension for Visual Studio 2005 a while ago but the extensibility model back then was orders of magnitude simpler than what we have now.  It required some amazing hacks and it was so complicated I never took it past being able to switch from insert mode to command mode and enter a few basic commands.  

Zach

# re: Vim Emulator Editor Extension Released @ Wednesday, September 09, 2009 2:31 PM

Not to be discouraging, but have you seen ViEmu? I presume if the Visual Studio 2010 extensibility isn't completely different there will be a version of ViEmu with support fairly soon.

It is done by a single developer (to the best of my knowledge) but he uses the proceeds of ViEmu to develop it full time and work out all the nasty and inevitable interoperability bugs that crop up with other add-ins.

Ian Banks

# re: Vim Emulator Editor Extension Released @ Wednesday, September 09, 2009 2:59 PM

@Ian

I've used and own ViEmu :)

Unfortunately it's not available for Visual Studio 2010 yet and I'm a bit of a Vim addict.  I started up this project in my spare time to compensate for the lack of ViEmu at work and home.  Given that ViEmu still isn't available for Beta1, and that the source is a good demo on how to interact with the new editor API, I decided to release it to the public.  

And yes, the current feature set of ViEmu trumps my hobby project in pretty much every area.  This is mainly a "for fun" project I used to get Vim back in Visual Studio 2010 and experiment with a non-trivial F# application.  

Jared Parsons

# re: Vim Emulator Editor Extension Released @ Wednesday, September 09, 2009 3:20 PM

codeplex seems like the obvious choice for posting the code.

jcoehoorn

# re: Vim Emulator Editor Extension Released @ Wednesday, September 09, 2009 3:49 PM

@jcoehoorn

Definitely agree.  But posting code publicly is almost never as simple as thinking about the most obvious choice :)

Jared Parsons

# re: Vim Emulator Editor Extension Released @ Thursday, September 10, 2009 12:11 PM

Very interesting! Thanks.

Do you plan to implement insert-mode commands like Ctrl-P and Ctrl-N?

Nemanja Trifunovic

# re: Vim Emulator Editor Extension Released @ Saturday, September 12, 2009 2:21 AM

Could you please expand on your approach?

Is it mainly just custom key event handlers?

subrat

# re: Vim Emulator Editor Extension Released @ Wednesday, October 21, 2009 2:56 AM

Link you gave seems to be not working.

This item is not yet published.

If you are the owner of this project, please sign in with the appropriate account.

bybor

# re: Vim Emulator Editor Extension Released @ Wednesday, October 21, 2009 10:01 AM

@bybor,

thanks for letting me know.  I just found out about this 2 days ago.  All Beta1 extensions were unpublished as soon as Visual Studio 2010 Beta2 went live.  I need to retarget my extension to Beta2 and republish the result.  I plan on doing so this weekend.  

Jared Parsons

# re: Vim Emulator Editor Extension Released @ Thursday, October 22, 2009 12:49 AM

@Jared Parsons,

Would be great, thanks

bybor

# re: Vim Emulator Editor Extension Released @ Thursday, October 22, 2009 9:16 AM

@subrat, after decompiling, this extension seems to be only using key handler, with differents states (normal, edit, command) written in F#

@Jared Parsons, will you release the sources ? I'm interesting in reading and maybe contributing to it.

I've decompiled it to read some parts of it, but Reflector doesn't like F# for now and the result it pretty ugly (a raw translation to C#).

nekresh

# re: Vim Emulator Editor Extension Released @ Thursday, October 22, 2009 10:28 AM

@nekresh, I'll be releasing the source this weekend when I update the package for Beta2.  I'll put an announcement on this blog as to where to grab the source.

Jared Parsons

# re: Vim Emulator Editor Extension Released @ Monday, November 16, 2009 11:19 PM

Wanted to let everyone who is monitoring comments that I posted an updated version for Beta2.  Happy Vim`ing!

http://blogs.msdn.com/jaredpar/archive/2009/11/16/vim-emulator-editor-for-beta2-released.aspx

Jared Parsons

# re: Vim Emulator Editor Extension Released @ Monday, November 30, 2009 10:33 AM

consider hosting the project at github

thinkhard

# re: Vim Emulator Editor Extension Released @ Monday, November 30, 2009 1:12 PM

@thinkhard

I actually do host this on GitHub as of a few days ago.  Right now it's in a private depot though so it's not visible.  I have to check on a few more things before I make it public.

However it won't be a truly public project though because i will not be able to take contributions from non-MS employees.  Not my decision, just the way of things right now.   But the source will be available for anyone to use.  

Jared Parsons

New Comments to this post are disabled
Page view tracker