Solution Poster:
Solution: There is a plugin in the standard Vim distribution: runtime / macros / editexisting.vim. Just copy it to the Vim plugin directory.
Additional Visual Studio Integration Details: Follow these steps to add Vim as an external tool and assign a convenient keyboard shortcut:
- Title: Vim
- Command: C: \ Program Files \ Vim \ vim70 \ gvim.exe
- Arguments: + $ (CurLine) "$ (ItemPath)"
- Start Directory: $ (SolutionDir)
Note. I use slightly different settings, so the cursor is set to a column from VS and centered in Vim:
- Arguments: + "cursor ($ (CurLine), $ (CurCol))" + "normal zz" $ (ItemPath)
- Start Directory: $ (FileDir)
Then set VS to automatically load chanages from Vim :
To use the two together effectively and make sure that .NET does not complain about file changes, goto Tools> Options> Environment> Documents and ensure these two options are checked: detect when the file is modified outside the environment. Changes to automatic loading (if not currently modified internally).
Finally, set Vim to automatically download changes made from VS :
: install autoread
My decision
Similar, but subtly fine: save it in a .settings file and import. Uses --servername and --remote-call to reuse an existing Vim adapted to the current solution.
<UserSettings> <ApplicationIdentity version="8.0"/> <ToolsOptions/> <Category name="Environment_Group" RegisteredName="Environment_Group"> <Category name="Environment_ExternalTools" Category="{E8FAE9E8-FBA2-4474-B134-AB0FFCFB291D}" Package="{DA9FB551-C724-11d0-AE1F-00A0C90FFFC3}" RegisteredName="Environment_ExternalTools" PackageName="Visual Studio Environment Package"> <PropertyValue name="edit with v&im.Command">gvim.exe</PropertyValue> <PropertyValue name="edit with v&im.Arguments">--servername $(SolutionFileName) --remote-silent +"call cursor($(CurLine),$(CurCol))" "$(ItemFileName)$(ItemExt)"</PropertyValue> <PropertyValue name="edit with v&im.InitialDirectory">$(ItemDir)</PropertyValue> <PropertyValue name="edit with v&im.SourceKeyName"/> <PropertyValue name="edit with v&im.UseOutputWindow">false</PropertyValue> <PropertyValue name="edit with v&im.PromptForArguments">false</PropertyValue> <PropertyValue name="edit with v&im.CloseOnExit">false</PropertyValue> <PropertyValue name="edit with v&im.IsGUIapp">true</PropertyValue> <PropertyValue name="edit with v&im.SaveAllDocs">true</PropertyValue> <PropertyValue name="edit with v&im.UseTaskList">false</PropertyValue> <PropertyValue name="edit with v&im.Unicode">false</PropertyValue> <PropertyValue name="edit with v&im.Package">{00000000-0000-0000-0000-000000000000}</PropertyValue> <PropertyValue name="edit with v&im.NameID">0</PropertyValue> </Category> </Category> </UserSettings>
John weldon
source share