Vim Tips Wiki
No edit summary
 
m (VisVim for Visual Sutdio .NET moved to VisVim for Visual Studio: Page moved by JohnBot to improve title)

Revision as of 10:08, 18 October 2007

Previous TipNext Tip

Tip: #946 - VisVim for Visual Studio

Created: June 6, 2005 20:59 Complexity: intermediate Author: neil Version: 6.0 Karma: 61/25 Imported from: Tip#946

The VisVim which comes with Vim 6.3 does not work with Visual Studio .NET. Here is an implementation of VisVim for VS.NET :


Setup:

http://www.kaoriya.net/testdir/VisVimNET/VisVimNETSetup-20040706.msi


Source Code:

http://www.kaoriya.net/testdir/VisVimNET/VisVimNET-20040706.tar.bz2


Looks like this implementation is completely different from the orignal VisVim. It will be great if the original VisVim is modified or this is included in the next Vim release. If you know any other VisVim implementation which works for VS.NET, please post the link here.

Comments

Hi, I've installed it, but how do you use it ? thanks

tonyhal888--AT--msn.com , June 7, 2005 11:37


read README_VisVim.txt in a directory tree of your Vim

Anonymous , June 8, 2005 5:51


When installed, this addin registers a new command ("Open with Vim") but doesn't put it in any menus or toolbars for you. You can add it to a menu or toolbar by using Tools/Customize, go to the Commands tab, select Addins in the left listbox, and scroll down to find "Open with Vim". Now drag that to a menu or toolbar.

Now open a file in VS.NET, move the cursor if you like, and click Open with Vim. It will launch vim and execute :drop for the file you had open in VS.NET. It then moves the currentpoint for vim to the same row and column that you had in VS.NET.

It also adds a section to the properties box called "VisVimNET" with these settings:

[ ] Change directory to file's one

(means that the cwd of vim will be changed to the parent directory of the file being edited) 

[ ] Make Vim foreground application

(supposed to bring Vim to the front when it executes - didn't work for me though) 

[ ] Set cursor at center of window

(executes zz after moving to the current row and column) 

[ ] Synchronize with activated window

(if this is checked, then each time you change files in VS.NET, commands will be sent to vim to put you in the same file.) 

Naturally, when you save a file in vim and then switch to VS.NET, VS.NET will detect that you changed the file and ask to reload it. And vice-versa.

It's pretty good, actually.

rpresser--AT--NOSPAMgmail.com , June 8, 2005 12:17


--AT--rpresser, thanks for the tips, very helpful. How did you discover these hidden stuffs?

Great!! Now I can use gvim in conjunction with VS.NET. My compliments to the author kaoriya.

I thought gvim will be shown inside the VS.net IDE (that's what embedded objects are supposed to do). Wasn't VisVim in VS6.0 like that?

The 'foreground' option works. The application requests for foreground, but windows does not allow it since it knows that you are currently very active (clicking the mouse buttons), so it just informs you that 'gvim' wants to come in foreground by blinking 'gvim' on the taskbar. The blinking in taskbar irritates me, so I just disable this option. Rest other 3 options are great.

I like one cool feature in VS.net Editor which I will like to see in gvim -> VS.net editor can undo even after reloading a file (i.e it knows it's the same file and figures out what are the changes) while gvim treats a reloaded file as entirely new and forgets the undo stack and you can't do undo after reloading in gvim.

neilNOEMAIL--AT--gmail.com , June 8, 2005 21:31


Can we assign a keyboard shortcut (Hotkey) for "Open with Vim" ?

neil , June 8, 2005 21:43


Its also very easy, in .NET, to add an External Tool having this command line: --servername=gmain --remote-silent +$(CurLine) +"normal zz" $(ItemPath)

and: $(ItemDir)

as the initial directory. The problem isn't with launching Vim from .NET, its not a problem, Vim is well made and behaves correctly. The problem is sending files from Vim to .NET. For that, there is already a tip explaining the procedure (VimTip580); its a bit of a hack but works great.

Anonymous , June 13, 2005 13:51


> --AT--rpresser, thanks for the tips, very helpful. How did you discover these hidden stuffs?

Mostly by studying the source code.

> I thought gvim will be shown inside the VS.net IDE (that's what embedded objects are supposed to do). Wasn't VisVim in VS6.0 like that?

Well, but this VisVim doesn't use Vim as an embedded object, just uses OLE as a communication channel. I never used VisVim in VS6.0.

I did try, separately, the commandline option

gvim -P "Microsoft Development" 

that lets Vim act as an MDI child to VS.NET; unfortunately, (a) the vim child window doesn't come to the front of the MDI stack automatically, and (b) VS.NET doesn't know that the vim child window is even there, so it doesn't make space for it when tiling or anything - and you can't get to it either through the Window pulldown menu or through ctrl-F6. Only way to see the vim window is by doing "Close All Documents", which makes it a pain in the butt.

> Can we assign a keyboard shortcut (Hotkey) for "Open with Vim" ?

Sure. Go Tools/Customize; hit the Keyboard button; pick VisVimNET.Connect.Open in the commands listbox; select Text Editor in the "Use new shortcut In" combobox; click in the box under "Press shortcut key:", and type a keystroke combination. I used Ctrl-X, Ctrl-V. When you click OK you may be warned that the keystroke scheme is a default and cannot be modified, so it wants to make a copy of the defaults.

rpresser at gmail.com , June 14, 2005 7:34


This has been working great, generally.

One question: is there a way to stop editing with Vim? Sometimes, when debugging, for example, I don't VS.net to keep opening files in my Vim session.

Anonymous , June 20, 2005 12:00


Best I've discovered is to turn synchronization off when I don't want it anymore, and turn it back on when I do.

Anonymous , June 20, 2005 12:29


This is great! Any chance their is a way to set this up to issue :sp on opening of a new file?

junk--AT--mike-jo.info , August 23, 2005 19:58


Errrr...I don't get it. The install appears to be in Chinese...?

Anonymous , October 5, 2005 9:16


Actually I think it is Japanese. Still I don't read either. Can someone put a cheat sheet here for the installation (i.e. the first radio group first option is X, second option is Y, etc). I tried a couple of random clickings and have not been able to get it to show up in the addin list for VS.NET. Maybe I am missing something.


Anonymous , April 4, 2006 7:21


I also left the previous note. I just noticed that it did install in VS 2003, but not in VS 2005. Any direction would be appreciated.

pohara--AT--cognex.com , April 4, 2006 7:35


The link doesn't work for me. :/

kotee--AT--elte.hu , October 11, 2006 0:39