我希望Vim重用当前存在的实例(如果存在).通常,Vim会弹出有关现有交换文件的警告.具体来说,这是为了在Vim和Visual Studio之间切换.(我知道ViEmu,但它不适用于Visual Studio Express.)
海报的解决方案:
解决方案: Vim的标准发行版中有一个插件:runtime/macros/editexisting.vim.只需将其复制到Vim插件目录即可.
Visual Studio集成的其他详细信息:按照以下步骤将Vim添加为外部工具并指定方便的键盘快捷方式:
注意我使用略有不同的设置,因此光标设置为VS中的列并以Vim为中心:
然后设置VS以自动加载由Vim制作的通道:
为了有效地将两者结合使用并确保.NET不会抱怨其文件发生变化,请转到工具>选项>环境>文档并确保选中这两个选项:检测文件何时在环境外更改.自动加载更改(如果当前未在环境中修改).
最后将Vim设置为自动加载VS所做的更改:
:设置autoread
我的解决方案
类似但略有不同:将其保存到.settings文件并导入.使用--servername和--remote-call重用现有的Vim,为当前的解决方案量身定制.
<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>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1221 次 |
| 最近记录: |