• 欢迎光临~

自己电脑上的vscode vim配置

开发技术 开发技术 2022-10-18 次浏览

setting.json

 // vscode 的vim配置
  "vim.easymotion": true,
  "vim.incsearch": true,
  "vim.leader": "<space>",
  "vim.useSystemClipboard": true,
  "vim.useCtrlKeys": true,
  "vim.hlsearch": true,
  "vim.highlightedyank.enable": true,
  "vim.foldfix": true,
  "vim.normalModeKeyBindings": [],
  "vim.normalModeKeyBindingsNonRecursive": [
    // Go to start or end of line
    {
      "before": [
        "H"
      ],
      "after": [
        "^"
      ]
    },
    {
      "before": [
        "L"
      ],
      "after": [
        "$"
      ]
    },
    // Jump to change
    {
      "before": [
        "[",
        "c"
      ],
      "commands": [
        "workbench.action.editor.previousChange"
      ]
    },
    {
      "before": [
        "]",
        "c"
      ],
      "commands": [
        "workbench.action.editor.nextChange"
      ]
    },
    // Move cursor between problems
    {
      "before": [
        "[",
        "d"
      ],
      "commands": [
        "editor.action.marker.prev"
      ]
    },
    {
      "before": [
        "]",
        "d"
      ],
      "commands": [
        "editor.action.marker.next"
      ]
    },
    // Code actions
    {
      "before": [
        "<leader>",
        "s",
        "a"
      ],
      "commands": [
        "editor.action.sourceAction"
      ]
    },
    // Quick fix
    {
      "before": [
        "<leader>",
        "q",
        "f"
      ],
      "commands": [
        "editor.action.quickFix"
      ]
    },
    // 重用名变量 
    {
      "before": [
        "<leader>",
        "r",
        "n"
      ],
      "commands": [
        "editor.action.rename"
      ]
    },
    // Format 格式化当前文件
    {
      "before": [
        "<leader>",
        "f",
        "m"
      ],
      "commands": [
        "editor.action.formatDocument"
      ]
    },
    // Find References
    {
      "before": [
        "g",
        "r"
      ],
      "commands": [
        "editor.action.goToReferences"
      ]
    },
    // 新建文件夹,在编辑器的区域
    {
      "before": [
        "<Leader>",
        "n",
        "d"
      ],
      "commands": [
        "explorer.newFolder"
      ]
    },
    // 新建文件,新建文件的位置取决于,文件资源管理器所在的位置
    {
      "before": [
        "<Leader>",
        "n",
        "f"
      ],
      "commands": [
        "explorer.newFile"
      ]
    },
    // 打开文件资源管理器,光标会聚焦到文件资源管理器的窗口 
    {
      "before": [
        "<leader>",
        "p",
        "o"
      ],
      "commands": [
        "workbench.view.explorer"
      ]
    },
    // 也是打开文件资源管理器,但是光标会聚焦到已经打开的文件资源窗口
    {
      "before": [
        "<leader>",
        "p",
        "O"
      ],
      "commands": [
        "workbench.files.action.showActiveFileInExplorer"
      ]
    },
    {
      "before": [
        "<leader>",
        "r",
      ],
      "command": "extension.runScript",
    },
    // close current edit window
    {
      "before": [
        "<leader>",
        "w",
        "c"
      ],
      "command": [
        "workbench.action.closeWindow"
      ]
    },
    // quick open
    {
      "before": [
        "<leader>",
        "q",
        "o"
      ],
      "commands": [
        "workbench.action.quickOpen"
      ]
    },
    // find char in files
    {
      "before": [
        "<leader>",
        "f",
        "f"
      ],
      "commands": [
        "workbench.action.findInFiles"
      ]
    },
    // 进入到terminal
    {
      "before": [
        "<leader>",
        "t",
        "t"
      ],
      "commands": [
        "workbench.action.terminal.toggleTerminal"
      ]
    },
    // 新建一个terminal终端
    {
      "before": [
        "<leader>",
        "t",
        "n"
      ],
      "commands": [
        "workbench.action.terminal.new"
      ]
    },
    // 隐藏和打开terminal 
    {
      "before": [
        "<leader>",
        "t",
        "h"
      ],
      "commands": [
        "workbench.action.togglePanel"
      ]
    },
    {
      "before": [
        "<leader>",
        "h",
        "e"
      ],
      "commands": [
        "workbench.action.maximizeEditor"
      ]
    },
    // 上下左右的移动pandel
    {
      "before": [
        "<leader>",
        "h"
      ],
      "commands": [
        "workbench.action.navigateLeft"
      ]
    },
    {
      "before": [
        "<leader>",
        "j"
      ],
      "commands": [
        "workbench.action.navigateDown"
      ]
    },
    {
      "before": [
        "<leader>",
        "k"
      ],
      "commands": [
        "workbench.action.navigateUp"
      ]
    },
    {
      "before": [
        "<leader>",
        "l"
      ],
      "commands": [
        "workbench.action.navigateRight"
      ]
    },
    // 移动下一个编辑器标签
    {
      "before": [
        "J",
      ],
      "commands": [
        "workbench.action.nextEditor"
      ]
    },
    // 移动到上一个编辑器标签
    {
      "before": [
        "K",
      ],
      "commands": [
        "workbench.action.previousEditor"
      ]
    },
    // 使用code run 来运行所有的代码
    {
      "before": [
        "<space>",
        "r",
        "r",
      ],
      "commands": [
        // "extension.runScript"
        // "autojspro.run"
        "code-runner.run"
      ]
    },
  ],
  "vim.insertModeKeyBindings": [
    // 退出插入模式
    {
      "before": [
        "j",
        "k"
      ],
      "after": [
        "<Esc>"
      ]
    }
  ],
  "vim.visualModeKeyBindingsNonRecursive": [
    // 移动到非空字符的行首
    {
      "before": [
        "H"
      ],
      "after": [
        "^"
      ]
    },
    // 移动到非空字符的行尾
    {
      "before": [
        "L"
      ],
      "after": [
        "$"
      ]
    }
  ],
  "editor.tokenColorCustomizations": {
    "[One Dark Modern]": {}
  },
  "vim.digraphs": {},
  "vim.commandLineModeKeyBindings": [],

keybings.json

// Place your key bindings in this file to override the defaultsauto[]
[
  // 以前配置的上下左右移动按键
  {
    "key": "alt+j",
    "command": "cursorLeft",
    "when": "textInputFocus"
  },
  {
    "key": "alt+k",
    "command": "cursorDown",
    "when": "textInputFocus"
  },
  {
    "key": "alt+l",
    "command": "cursorRight",
    "when": "textInputFocus"
  },
  {
    "key": "alt+i",
    "command": "cursorUp",
    "when": "textInputFocus"
  },
  // 切换到文件浏览器,可以在任何位置
  {
    "key": "ctrl+;",
    "command": "workbench.view.explorer",
    "when": "viewContainer.workbench.view.explorer.enabled"
  },
  // 切换到代码编辑区,不论在任何位置
  {
    "key": "ctrl+'",
    "command": "workbench.action.focusFirstEditorGroup"
  },
  // 切换到terminal终端
  {
    "key": "ctrl+,",
    "command": "workbench.action.terminal.toggleTerminal",
    "when": "terminal.active"
  },
  // 打开一个新的terminal
  {
    "key": "ctrl+shift+,",
    "command": "workbench.action.terminal.new",
    "when": "terminalProcessSupported || terminalWebExtensionContributedProfile"
  },
  // 在文件夹资源管理器中新建一个文件
  {
    "key": "a",
    "command": "explorer.newFile",
    "when": "filesExplorerFocus && !inputFocus"
  },
  // 在文件资源管理器里面创建一个文件夹
  {
    "key": "shift+a",
    "command": "explorer.newFolder",
    "when": "filesExplorerFocus && !inputFocus"
  },
  // 在文件资源管理器里面重应名当前文件或文件夹
  {
    "key": "r",
    "command": "renameFile",
    "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
  },
  // 在文件资源管理器中删除文件
  {
    "key": "d",
    "command": "deleteFile",
    "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceReadonly && !inputFocus"
  },
  // 使用code runner运行所有的代码
  {
    "key": "ctrl+r",
    "command": "code-runner.run"
  },
  // 将编辑区域最大化,也就是隐藏文件浏览器
  {
    "key": "ctrl+h",
    "command": "workbench.action.maximizeEditor"
  }
]
程序员灯塔
转载请注明原文链接:自己电脑上的vscode vim配置
喜欢 (0)