【问题标题】:How to map "Go To Implementation" using VsCode Vim?如何使用 VsCode Vim 映射“Go To Implementation”?
【发布时间】:2022-12-11 01:44:28
【问题描述】:

我想映射类似的东西例如打开 Typescript 接口实现。在 VsCode 中,快捷方式是 Ctrl + F12,我试图在 .vimrc 文件中添加这样的地图 inoremap gi <C-F12>,但这不起作用。

我也试着在我的设置.json但仍然没有结果。

"vim.insertModeKeyBindings": [
   {
      "before": ["g", "I"],
      "after": ["<C-F12>"]
   }
]

我怎样才能做到这一点?

【问题讨论】:

    标签: visual-studio-code vim vim-plugin


    【解决方案1】:

    您可以通过将快捷方式映射到 VSCode 命令而不是一组键来实现这一点。如果您查看 VSCode 快捷方式,您会发现 Go To Definition 操作与命令相关,因此您可以使用该命令并映射到您的 vim 快捷方式设置.json文件。

    在示例中,我会将 gI 映射到 editor.action.goToImplementation,这是相关命令。

      "vim.insertModeKeyBindings": [
        {
          "before": ["g", "I"],
          "commands": ["editor.action.goToImplementation"]
        }
      ],
    
      "vim.normalModeKeyBindings": [
        {
          "before": ["g", "I"],
          "commands": ["editor.action.goToImplementation"]
        }
      ]
    

    【讨论】:

      猜你喜欢
      • 2014-09-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多