gpt4 book ai didi

visual-studio - 如何在现有 Vim 实例中打开文件而不是收到 "existing swapfile "警告

转载 作者:行者123 更新时间:2023-12-04 12:15:01 26 4
gpt4 key购买 nike

我希望 Vim 重用当前存在的实例(如果存在)。通常,Vim 会弹出有关现有交换文件的警告。具体来说,这是为了在 Vim 和 Visual Studio 之间切换。 (我知道 ViEmu,但它不适用于 Visual Studio Express。)

最佳答案

海报解决方案:

解决方案:
Vim 的标准发行版中有一个插件:runtime/macros/editexisting.vim。只需将其复制到 Vim 插件目录即可。

Visual Studio 集成的额外详细信息:关注 these steps添加 Vim 作为外部工具并指定一个方便的键盘快捷键:

  • 标题: Vim
  • 命令:C:\Program Files\Vim\vim70\gvim.exe
  • 参数:+$(CurLine) "$(ItemPath)"
  • 初始目录:$(SolutionDir)

  • 注意我使用了稍微不同的设置,因此光标设置为来自 VS 的列并在 Vim 中居中:
  • 参数: +"调用光标($(CurLine),$(CurCol))"+"正常zz" $(ItemPath)
  • 初始目录:$(FileDir)

  • 然后将 VS 设置为 automatically load chanages made from Vim :

    In order to effectively use the two together and make sure .NET does not complain about its files changing, goto Tools > Options > Environment > Documents and ensure these two options are checked: Detect when file is changed outside the environment. Auto-load changes (if not currently modified inside the environment).



    最后将 Vim 设置为 automatically load changes made from VS :

    :set 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&amp;im.Command">gvim.exe</PropertyValue>
    <PropertyValue name="edit with v&amp;im.Arguments">--servername $(SolutionFileName) --remote-silent +"call cursor($(CurLine),$(CurCol))" "$(ItemFileName)$(ItemExt)"</PropertyValue>
    <PropertyValue name="edit with v&amp;im.InitialDirectory">$(ItemDir)</PropertyValue>
    <PropertyValue name="edit with v&amp;im.SourceKeyName"/>
    <PropertyValue name="edit with v&amp;im.UseOutputWindow">false</PropertyValue>
    <PropertyValue name="edit with v&amp;im.PromptForArguments">false</PropertyValue>
    <PropertyValue name="edit with v&amp;im.CloseOnExit">false</PropertyValue>
    <PropertyValue name="edit with v&amp;im.IsGUIapp">true</PropertyValue>
    <PropertyValue name="edit with v&amp;im.SaveAllDocs">true</PropertyValue>
    <PropertyValue name="edit with v&amp;im.UseTaskList">false</PropertyValue>
    <PropertyValue name="edit with v&amp;im.Unicode">false</PropertyValue>
    <PropertyValue name="edit with v&amp;im.Package">{00000000-0000-0000-0000-000000000000}</PropertyValue>
    <PropertyValue name="edit with v&amp;im.NameID">0</PropertyValue>
    </Category>
    </Category>
    </UserSettings>

    关于visual-studio - 如何在现有 Vim 实例中打开文件而不是收到 "existing swapfile "警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1853052/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com