Register | Login

Stacking Code

public interface IBlog { string Dump(Stream consciousness); }

Visual Studio 2010 and Vim

Saturday, 19 November, 2011 @ 5:42 PM < Adam Boddington
Tags: Vim, Visual Studio

I've been relearning Vim over the last couple of weeks. I love it as an editor, but I still find myself using Visual Studio to create files, which adds them to projects for me; and to use ReSharper, for finding types, inserting namespaces, etc.

So once a file is created or a type is found in Visual Studio, what's the easiest way to edit it in Vim? These two links have some great stuff:

The short answer is to define Vim as an external tool and give it a shortcut. One thing I would add though... in the arguments, prefix the server name with g. This forces gVim to take focus and may save an alt-tab.

External Tools

The arguments are --servername gVimualStudio --remote-silent +"call cursor($(CurLine), $(CurCol))" "$(ItemPath)".

The server name tells gVim to use a named instance, which is useful once you have a few files open. The --remote-silent argument sends a command (marked with +) after the file is open. The call cursor command moves the cursor to the right spot in the file. $(CurLine), $(CurCol), $(ItemPath) and $(SolutionDir) are all Visual Studio variables which get converted to values before execution.

See these links for more information:

As Kevin Berridge suggested, I mapped Vim to ctrl-shift-v, ctrl-shift-v. But alt-t, v will also work thanks to the ampersand in &Vim above.

Options

There are 0 comments.


Comments

Leave a Comment

Please register or login to leave a comment.


Older
Zenburn PowerShell

Newer
Readable Code with Extension Methods

Older
Zenburn PowerShell

Newer
Readable Code with Extension Methods

browse with Pivot


About


Projects

Building Neno


RSS
Recent Posts

Codility Nitrogenium Challenge
OS X Lock
HACT '13
Codility Challenges
Priority Queue


Tags

Architecture (13)
ASP.NET (2)
ASP.NET MVC (13)
Brisbane Flood (1)
Building Neno (38)
C# (4)
Challenges (3)
Collections (1)
Communicator (1)
Concurrency Control (2)
Configuration (1)
CSS (5)
DataAnnotations (2)
Database (1)
DotNetOpenAuth (2)
Entity Framework (1)
FluentNHibernate (2)
Inversion of Control (5)
JavaScript (1)
jQuery (4)
Kata (2)
Linq (7)
Markdown (4)
Mercurial (5)
NHibernate (20)
Ninject (2)
OpenID (3)
OS X (1)
Pivot (6)
PowerShell (8)
Prettify (2)
RSS (1)
Spring (3)
SQL Server (5)
T-SQL (2)
Validation (2)
Vim (1)
Visual Studio (2)
Windows Forms (3)
Windows Service (1)


Archives


Powered by Neno, ASP.NET MVC, NHibernate, and small furry mammals. Copyright 2010 - 2011 Adam Boddington.
Version 1.0 Alpha (d9e7e4b68c07), Build Date Sunday, 30 January, 2011 @ 11:37 AM