logo
Published on

vim-vscode

  • Author Avatar
    lik
    Author lik
    lik
    Author Link
    Github
搭配快捷键使用

跳转来回:

  1. 编辑器 - 终端
    1. <leader> t 编辑器 -> 终端
    2. cmd e 终端 -> 编辑器
  2. 编辑器 - 文件夹
    1. <leader> e 编辑器 -> 文件夹
    2. <leader> e 文件夹 -> 编辑器
  3. 文件夹 - 终端
    1. space t 文件夹 -> 终端
    2. cmd e 终端 -> 编辑器
    3. cmd shift e 终端 -> 文件夹

终端:

  1. cmd s 切换终端(命令行)
  2. cmd + shift + [ / cmd + shift + ] 切换终端
  3. cmd n 新建终端

打开文件:

  1. l 打开(固定)编辑器

其他跳转:

  1. [ e [ w / ] e ] w 跳报错/警告
  2. f/F -> s/S, 覆盖原 f
快捷键配置
[
  // >>> vim 快捷键配合
  {
    "key": "space e",
    "command": "workbench.action.focusActiveEditorGroup",
    "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !inputFocus"
  },
  {
    "key": "space t",
    "command": "workbench.action.terminal.focus",
    "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !inputFocus"
  },
  {
    "key": "cmd+e",
    "command": "-actions.findWithSelection"
  },
  // 终端
  {
    "key": "cmd+s",
    "command": "workbench.action.quickOpenTerm",
    "when": "terminal.active && terminal.visible && terminalFocus"
  },
  {
    "key": "cmd+[BracketLeft]",
    "command": "workbench.action.terminal.focusPrevious",
    "when": "terminal.visible && terminalFocus"
  },
  {
    "key": "cmd+[BracketRight]",
    "command": "workbench.action.terminal.focusNext",
    "when": "terminal.visible && terminalFocus"
  },
  {
    "key": "cmd+e",
    "command": "workbench.action.focusActiveEditorGroup",
    "when": "terminal.visible && terminalFocus"
  },
  {
    "key": "cmd+n",
    "command": "workbench.action.terminal.new",
    "when": "terminal.active && terminal.visible && terminalFocus"
  },
  {
    "key": "cmd+i",
    "command": "-workbench.action.chat.startVoiceChat",
    "when": "chatIsEnabled && hasSpeechProvider && inChatInput && !chatSessionRequestInProgress && !editorFocus && !notebookEditorFocused && !scopedVoiceChatGettingReady && !speechToTextInProgress || chatIsEnabled && hasSpeechProvider && inlineChatFocused && !chatSessionRequestInProgress && !editorFocus && !notebookEditorFocused && !scopedVoiceChatGettingReady && !speechToTextInProgress"
  },
  {
    "key": "cmd+i",
    "command": "-workbench.action.chat.stopListeningAndSubmit",
    "when": "inChatInput && voiceChatInProgress && scopedVoiceChatInProgress == 'editor' || inChatInput && voiceChatInProgress && scopedVoiceChatInProgress == 'inline' || inChatInput && voiceChatInProgress && scopedVoiceChatInProgress == 'quick' || inChatInput && voiceChatInProgress && scopedVoiceChatInProgress == 'view' || inlineChatFocused && voiceChatInProgress && scopedVoiceChatInProgress == 'editor' || inlineChatFocused && voiceChatInProgress && scopedVoiceChatInProgress == 'inline' || inlineChatFocused && voiceChatInProgress && scopedVoiceChatInProgress == 'quick' || inlineChatFocused && voiceChatInProgress && scopedVoiceChatInProgress == 'view'"
  },
  {
    "key": "cmd+i",
    "command": "-inlineChat.start",
    "when": "editorFocus && inlineChatHasEditsAgent && inlineChatPossible && !editorReadonly && !editorSimpleInput || editorFocus && inlineChatHasProvider && inlineChatPossible && !editorReadonly && !editorSimpleInput"
  },
  {
    "key": "cmd+k",
    "command": "-cursorai.action.generateInTerminal",
    "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalPromptBarVisible || terminalProcessSupported && terminalPromptBarVisible"
  },
  {
    "key": "cmd+i",
    "command": "-editor.action.triggerSuggest",
    "when": "editorHasCompletionItemProvider && textInputFocus && !editorReadonly && !suggestWidgetVisible"
  },
  {
    "key": "cmd+i",
    "command": "-workbench.action.terminal.chat.start",
    "when": "terminalChatAgentRegistered && terminalFocusInAny && terminalHasBeenCreated || terminalChatAgentRegistered && terminalFocusInAny && terminalProcessSupported"
  },
  {
    "key": "cmd+i",
    "command": "-composer.startComposerPrompt"
  },
  {
    "key": "tab f",
    "command": "editor.action.inlineSuggest.jump",
    "when": "inlineEditIsVisible && tabShouldJumpToInlineEdit && !editorHoverFocused && !editorTabMovesFocus && !suggestWidgetVisible"
  },
  {
    "key": "tab",
    "command": "-editor.action.inlineSuggest.jump",
    "when": "inlineEditIsVisible && tabShouldJumpToInlineEdit && !editorHoverFocused && !editorTabMovesFocus && !suggestWidgetVisible"
  },
  {
    "key": "tab f",
    "command": "editor.action.acceptCursorTabSuggestion",
    "when": "cpp.shouldAcceptTab"
  },
  {
    "key": "tab",
    "command": "-editor.action.acceptCursorTabSuggestion",
    "when": "cpp.shouldAcceptTab"
  },
  {
    "key": "tab f",
    "command": "editor.action.acceptGPT4",
    "when": "hasGPT4Diff"
  },
  {
    "key": "tab",
    "command": "-editor.action.acceptGPT4",
    "when": "hasGPT4Diff"
  },
  // vim快捷键 <<<
]
其他快捷键
  // 折叠和展开
  {
    "key": "cmd+k cmd+l",
    "command": "editor.toggleFold",
    "when": "editorTextFocus && foldingEnabled"
  },
  {
    "key": "cmd+r cmd+l",
    "command": "-editor.toggleFold",
    "when": "editorTextFocus && foldingEnabled"
  },
  {
    "key": "cmd+k cmd+0",
    "command": "editor.foldAll",
    "when": "editorTextFocus && foldingEnabled"
  },
  {
    "key": "cmd+r cmd+0",
    "command": "-editor.foldAll",
    "when": "editorTextFocus && foldingEnabled"
  },
  {
    "key": "cmd+k cmd+j",
    "command": "editor.unfoldAll",
    "when": "editorTextFocus && foldingEnabled"
  },
  {
    "key": "cmd+r cmd+j",
    "command": "-editor.unfoldAll",
    "when": "editorTextFocus && foldingEnabled"
  },
vim 配置
  // vim 配置 >>>>
  "vim.useSystemClipboard": true,
  "vim.smartRelativeLine": true,
  "vim.enableNeovim": false,
  "vim.easymotion": true,
  "vim.autoSwitchInputMethod.enable": true,
  "vim.autoSwitchInputMethod.defaultIM": "com.apple.keylayout.ABC",
  "vim.autoSwitchInputMethod.obtainIMCmd": "/opt/homebrew/bin/im-select",
  "vim.autoSwitchInputMethod.switchIMCmd": "/opt/homebrew/bin/im-select {im}",
  "vim.surround": true,
  "vim.sneak": true,
  "vim.sneakUseIgnorecaseAndSmartcase": true,
  "vim.leader": "<space>",
  "vim.foldfix": true,
  "vim.normalModeKeyBindingsNonRecursive": [
    // 跳终端
    {
      "before": [
        "<leader>",
        "t"
      ],
      "commands": [
        "workbench.action.terminal.focus"
      ]
    },
    // 跳文件夹
    {
      "before": [
        "<leader>",
        "e"
      ],
      "commands": [
        "workbench.view.explorer"
      ]
    },
    // 跳报错
    {
      "before": [
        "]",
        "e"
      ],
      "commands": [
        "editor.action.marker.next"
      ],
      "when": "editorHasMarkers(Error)"
    },
    {
      "before": [
        "[",
        "e"
      ],
      "commands": [
        "editor.action.marker.prev"
      ],
      "when": "editorHasMarkers(Error)"
    },
    // 跳 warning
    {
      "before": [
        "]",
        "w"
      ],
      "commands": [
        "editor.action.marker.next"
      ],
      "when": "editorHasMarkers(Warning)"
    },
    {
      "before": [
        "[",
        "w"
      ],
      "commands": [
        "editor.action.marker.prev"
      ],
      "when": "editorHasMarkers(Warning)"
    }
  ],
  "vim.replaceWithRegister": true,
  "vim.camelCaseMotion.enable": true,
  // <<<< vim 配置