Skip to content

热键定义

向军大叔每晚八点在 抖音bilibli 直播

xj-small

我使用的主题是 Monokai Pro,我使用的字体是 CascadiaCodePL-Light

配置合理的快捷键可以加快代码录入效率,VSCODE 提供了丰富的快捷键设置,当然我们也可以自行定义快捷键

设置方式

修改热键可以通过 command+k+s,windows 用户使用 ctrl+k+s 打开设置窗口

image-20200611232259186

我已经将我在 MAC 和 WINDOWS 中的热键定义写在下面,操作步骤为打开配置文件将内容粘贴到里面即可。你可以根据需要自行修改。

配置项

下面是我定制的一些快捷键来提高效率,大家可以根据需要进行取舍

MAC

下面是向军大叔 MAC 系统中的热键定义

[
  {
    "key": "cmd+e",
    "command": "-workbench.action.openRecent"
  },
  {
    "key": "cmd+e",
    "command": "extension.intellijRecentFiles",
    "when": "!inQuickOpen"
  },
  {
    "key": "cmd+e",
    "command": "workbench.action.quickOpenNavigateNext",
    "when": "inQuickOpen"
  },
  {
    "key": "cmd+e",
    "command": "workbench.action.quickOpenNavigateNext",
    "when": "inQuickOpen"
  },
  {
    "key": "alt+escape",
    "command": "-editor.action.triggerSuggest",
    "when": "editorHasCompletionItemProvider && textInputFocus && !editorReadonly"
  },
  {
    "key": "alt+x",
    "command": "editor.action.toggleWordWrap"
  },
  {
    "key": "alt+z",
    "command": "-editor.action.toggleWordWrap"
  },
  {
    "key": "shift+cmd+o",
    "command": "-ftp.open"
  },
  {
    "key": "alt+1",
    "command": "workbench.action.terminal.focusPrevious"
  },
  {
    "key": "shift+cmd+d",
    "command": "editor.action.revealDefinition",
    "when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
  },
  {
    "key": "f12",
    "command": "-editor.action.revealDefinition",
    "when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
  },
  {
    "key": "cmd+;",
    "command": "editor.action.openLink"
  },
  {
    "key": "cmd+j",
    "command": "workbench.action.toggleSidebarVisibility"
  },
  {
    "key": "cmd+b",
    "command": "-workbench.action.toggleSidebarVisibility"
  },
  {
    "key": "shift+cmd+r",
    "command": "workbench.files.action.collapseExplorerFolders"
  },
  {
    "key": "cmd+h",
    "command": "extension.dash.all",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+alt+h",
    "command": "-extension.dash.all",
    "when": "editorTextFocus"
  },
  {
    "key": "cmd+k cmd+z",
    "command": "workbench.action.toggleZenMode"
  },
  {
    "key": "cmd+k z",
    "command": "-workbench.action.toggleZenMode"
  },
  {
    "key": "cmd+k cmd+h",
    "command": "workbench.action.toggleActivityBarVisibility"
  },
  {
    "key": "shift+cmd+k",
    "command": "editor.action.formatDocument",
    "when": "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly && !inCompositeEditor"
  },
  {
    "key": "shift+alt+f",
    "command": "-editor.action.formatDocument",
    "when": "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly && !inCompositeEditor"
  },
  {
    "key": "ctrl+h",
    "command": "workbench.action.previousEditor"
  },
  {
    "key": "shift+cmd+[",
    "command": "-workbench.action.previousEditor"
  },
  {
    "key": "ctrl+i",
    "command": "volar.action.splitEditors"
  },
  {
    "key": "ctrl+k",
    "command": "workbench.action.focusRightGroup"
  },
  {
    "key": "cmd+k cmd+right",
    "command": "-workbench.action.focusRightGroup"
  },
  {
    "key": "cmd+r",
    "command": "vite.open"
  },
  {
    "key": "cmd+p",
    "command": "workbench.action.quickOpen"
  },
  {
    "key": "cmd+p",
    "command": "-workbench.action.quickOpen"
  },
  {
    "key": "shift+cmd+e",
    "command": "workbench.view.explorer",
    "when": "viewContainer.workbench.view.explorer.enabled"
  },
  {
    "key": "shift+cmd+e",
    "command": "-workbench.view.explorer",
    "when": "viewContainer.workbench.view.explorer.enabled"
  },
  {
    "key": "ctrl+shift+cmd+n",
    "command": "explorer.newFolder"
  },
  {
    "key": "cmd+n",
    "command": "dynoFileUtils.newItems"
  },
  {
    "key": "alt+n",
    "command": "-dynoFileUtils.newItems"
  },
  {
    "key": "cmd+;",
    "command": "workbench.action.terminal.toggleTerminal",
    "when": "terminal.active"
  },
  {
    "key": "ctrl+`",
    "command": "-workbench.action.terminal.toggleTerminal",
    "when": "terminal.active"
  },
  {
    "key": "cmd+u",
    "command": "code-runner.run"
  },
  {
    "key": "ctrl+alt+n",
    "command": "-code-runner.run"
  },
  {
    "key": "cmd+l cmd+o",
    "command": "livePreview.start.preview.atFile"
  },
  {
    "key": "shift+cmd+n",
    "command": "welcome.showNewFileEntries"
  },
  {
    "key": "ctrl+alt+cmd+n",
    "command": "-welcome.showNewFileEntries"
  }
]

WINDOWS

下面是大叔 WINDOWS 系统中的定义

[
  {
    "key": "ctrl+e",
    "command": "-workbench.action.openRecent"
  },
  {
    "key": "ctrl+e",
    "command": "extension.intellijRecentFiles",
    "when": "!inQuickOpen"
  },
  {
    "key": "ctrl+e",
    "command": "workbench.action.quickOpenNavigateNext",
    "when": "inQuickOpen"
  },
  {
    "key": "ctrl+e",
    "command": "workbench.action.quickOpenNavigateNext",
    "when": "inQuickOpen"
  },
  {
    "key": "shift+ctrl+e",
    "command": "workbench.action.quickOpenNavigatePrevious",
    "when": "inQuickOpen"
  },
  {
    "key": "ctrl+j",
    "command": "editor.action.triggerSuggest",
    "when": "editorHasCompletionItemProvider && textInputFocus && !editorReadonly"
  },
  {
    "key": "ctrl+escape",
    "command": "-editor.action.triggerSuggest",
    "when": "editorHasCompletionItemProvider && textInputFocus && !editorReadonly"
  },
  {
    "key": "alt+x",
    "command": "editor.action.toggleWordWrap"
  },
  {
    "key": "alt+z",
    "command": "editor.action.toggleWordWrap"
  },
  {
    "key": "ctrl+shift+o",
    "command": "workbench.action.gotoSymbol"
  },
  {
    "key": "ctrl+shift+left",
    "command": "cursorHomeSelect",
    "when": "textInputFocus"
  },
  {
    "key": "shift+home",
    "command": "-cursorHomeSelect",
    "when": "textInputFocus"
  },
  {
    "key": "ctrl+shift+right",
    "command": "cursorEndSelect",
    "when": "textInputFocus"
  },
  {
    "key": "shift+end",
    "command": "-cursorEndSelect",
    "when": "textInputFocus"
  },
  {
    "key": "ctrl+right",
    "command": "cursorEnd",
    "when": "textInputFocus"
  },
  {
    "key": "end",
    "command": "-cursorEnd",
    "when": "textInputFocus"
  },
  {
    "key": "ctrl+left",
    "command": "cursorHome",
    "when": "textInputFocus"
  },
  {
    "key": "home",
    "command": "-cursorHome",
    "when": "textInputFocus"
  },
  {
    "key": "ctrl+up",
    "command": "cursorTop",
    "when": "textInputFocus"
  },
  {
    "key": "ctrl+home",
    "command": "-cursorTop",
    "when": "textInputFocus"
  },
  {
    "key": "ctrl+down",
    "command": "cursorBottom",
    "when": "textInputFocus"
  },
  {
    "key": "ctrl+end",
    "command": "-cursorBottom",
    "when": "textInputFocus"
  },
  {
    "key": "alt+1",
    "command": "workbench.action.terminal.focusAtIndex1"
  },
  {
    "key": "alt+2",
    "command": "workbench.action.terminal.focusAtIndex2"
  },
  {
    "key": "alt+3",
    "command": "workbench.action.terminal.focusAtIndex3"
  },
  {
    "key": "alt+4",
    "command": "workbench.action.terminal.focusAtIndex4"
  },
  {
    "key": "ctrl+shift+r",
    "command": "renameFile",
    "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
  },
  {
    "key": "f2",
    "command": "-renameFile",
    "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
  },
  {
    "key": "ctrl+oem_1",
    "command": "workbench.action.terminal.toggleTerminal"
  },
  {
    "key": "ctrl+oem_3",
    "command": "-workbench.action.terminal.toggleTerminal"
  },
  {
    "key": "ctrl+1",
    "command": "workbench.action.toggleSidebarVisibility"
  },
  {
    "key": "ctrl+b",
    "command": "-workbench.action.toggleSidebarVisibility"
  },
  {
    "key": "ctrl+shift+d",
    "command": "editor.action.revealDefinition",
    "when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
  },
  {
    "key": "f12",
    "command": "-editor.action.revealDefinition",
    "when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
  }
]

系统配置

下面是系统配置项,你可以从中查看到 vim 等配置内容。

{
  "editor.quickSuggestions": {
    "strings": true
  },
  "workbench.iconTheme": "material-icon-theme",
  "editor.fontSize": 20,
  "markdown.preview.fontSize": 16,
  "editor.fontLigatures": true,
  "sync.quietSync": true,
  "liveServer.settings.donotShowInfoMsg": true,
  "editor.minimap.enabled": false,
  "terminal.integrated.lineHeight": 0,
  "workbench.list.horizontalScrolling": true,
  "debug.console.fontFamily": "",
  "workbench.startupEditor": "newUntitledFile",
  "prettier.semi": false,
  "prettier.printWidth": 160,
  "workbench.editor.limit.enabled": true,
  "[json]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "editor.formatOnSave": true,
  "editor.fontFamily": "CascadiaMono,OperatorMonoLig-Book,'JetBrainsMono-Light','FiraCode-Light','Hack-Regular','JetBrains Mono','FiraCode-Retina','Operator Mono Lig',Menlo,Monaco, 'Courier New', monospace",
  "terminal.integrated.fontFamily": "'JetBrains Mono','Fira Code',Menlo,Monaco, 'Courier New', monospace",
  "liveServer.settings.donotVerifyTags": true,
  "php.validate.enable": false,
  "zenMode.centerLayout": false,
  "zenMode.restore": true,

  "vim.commandLineModeKeyBindingsNonRecursive": [],
  "vim.sneak": true,
  "vim.normalModeKeyBindingsNonRecursive": [
    {
      "before": [","],
      "after": [":"]
    },
    //转到代码定义
    {
      "before": ["<leader>", "d"],
      "commands": ["editor.action.revealDefinition"]
    },
    {
      "before": ["<leader>", "j"],
      "commands": ["workbench.action.toggleSidebarVisibility"]
    }
  ],
  "vim.insertModeKeyBindings": [
    //返回normal模式
    {
      "before": ["j", "j"],
      "after": ["<Esc>"]
    }
  ],
  "vim.normalModeKeyBindings": [
    //保存
    {
      "before": ["s", "s"],
      "commands": ["workbench.action.files.save"]
    },
    {
      "before": ["L"],
      "after": ["$"]
    },
    {
      "before": ["H"],
      "after": ["^"]
    }
  ],
  "vim.leader": "<space>",
  "vim.easymotionMarkerForegroundColorOneChar": "#ffffff",
  "vim.easymotionMarkerBackgroundColor": "#DC2119",
  "vim.useSystemClipboard": true,
  // "vim.camelCaseMotion.enable": true,
  "vim.handleKeys": {
    // "<C-a>": false
    // "<C-f>": false
    // "<C-c>": false,
    // "<C-x>": false,
    // "<C-v>": false
  },
  "vetur.completion.scaffoldSnippetSources": {},
  "eslint.codeAction.showDocumentation": {},
  "eslint.validate": ["javascript", "javascriptreact", "vue"],
  "sync.forceDownload": false,
  "workbench.editor.showTabs": false,
  "blade.format.enable": true,
  "files.exclude": {
    ".vscode": true,
    "*.code-workspace": true,
    "**/node_modules": true,
    "**/public/js/app.js": true,
    "**/unpackage": true,
    "**/vendor.js": true
  },
  "files.watcherExclude": {
    "**/vendor/**": true
  },
  "editor.largeFileOptimizations": false,
  "git.ignoreLegacyWarning": true,
  "zenMode.hideLineNumbers": false,
  "search.showLineNumbers": true,
  "vim.statusBarColors.commandlineinprogress": "",
  "breadcrumbs.symbolPath": "off",
  "breadcrumbs.enabled": true,
  "terminal.integrated.fontWeightBold": "normal",
  "[php]": {
    "editor.defaultFormatter": "bmewburn.vscode-intelephense-client"
  },
  "workbench.statusBar.visible": true,
  "compile-hero.ignore": "",
  "[scss]": {
    "editor.suggest.insertMode": "replace",
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[blade]": {
    "editor.defaultFormatter": "onecentlin.laravel-blade"
  },
  "[vue]": {
    "editor.defaultFormatter": "johnsoncodehk.volar"
  },
  "editor.cursorSmoothCaretAnimation": true,
  "vim.operatorPendingModeKeyBindings": [],
  "html.format.extraLiners": "head, body, /html",
  "screencastMode.keyboardOverlayTimeout": 600,
  "screencastMode.verticalOffset": 10,
  "screencastMode.fontSize": 55,
  "prettier.vueIndentScriptAndStyle": true,
  "tabnine.experimentalAutoImports": true,
  "scss.implicitlyLabel": "",
  "explorer.confirmDelete": false,
  "explorer.confirmDragAndDrop": false,
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "vim.commandLineModeKeyBindings": [],
  "tailwindCSS.includeLanguages": {
    "plaintext": "html"
  },
  "vim.startInInsertMode": true,
  "vim.autoSwitchInputMethod.defaultIM": "com.apple.keylayout.ABC",
  "vim.autoSwitchInputMethod.obtainIMCmd": "/usr/local/bin/im-select",
  "vim.autoSwitchInputMethod.switchIMCmd": "/usr/local/bin/im-select {im}",
  "prettier.jsxSingleQuote": true,
  "prettier.singleQuote": true,
  "markdown.preview.lineHeight": 15,
  "editor.wordWrapColumn": 160,
  "editor.lineNumbers": "relative",
  "css.lint.compatibleVendorPrefixes": "error",
  "vim.textwidth": 160,
  "html.format.wrapLineLength": 160,
  "vetur.ignoreProjectWarning": true,
  "prettier.arrowParens": "avoid",
  "vim.easymotion": true,
  "workbench.editor.limit.value": 3,
  "explorer.openEditors.visible": 3,
  "html.format.wrapAttributes": "preserve-aligned",
  "vim.overrideCopy": false,
  "editor.wordWrap": "bounded",
  "kite.showWelcomeNotificationOnStartup": false,
  "git.enableSmartCommit": true,
  "material-icon-theme.activeIconPack": "vue_vuex",
  "material-icon-theme.opacity": 1,
  "editor.rulers": [],
  "hediet.vscode-drawio.local-storage": "eyIuZHJhd2lvLWNvbmZpZyI6IntcImxhbmd1YWdlXCI6XCJcIixcImN1c3RvbUZvbnRzXCI6W10sXCJsaWJyYXJpZXNcIjpcImdlbmVyYWxcIixcImN1c3RvbUxpYnJhcmllc1wiOltcIkwuc2NyYXRjaHBhZFwiXSxcInBsdWdpbnNcIjpbXSxcInJlY2VudENvbG9yc1wiOltdLFwiZm9ybWF0V2lkdGhcIjowLFwiY3JlYXRlVGFyZ2V0XCI6ZmFsc2UsXCJwYWdlRm9ybWF0XCI6e1wieFwiOjAsXCJ5XCI6MCxcIndpZHRoXCI6MTY1NCxcImhlaWdodFwiOjExNjl9LFwic2VhcmNoXCI6dHJ1ZSxcInNob3dTdGFydFNjcmVlblwiOnRydWUsXCJncmlkQ29sb3JcIjpcIiNkMGQwZDBcIixcImRhcmtHcmlkQ29sb3JcIjpcIiM2ZTZlNmVcIixcImF1dG9zYXZlXCI6dHJ1ZSxcInJlc2l6ZUltYWdlc1wiOm51bGwsXCJvcGVuQ291bnRlclwiOjAsXCJ2ZXJzaW9uXCI6MTgsXCJ1bml0XCI6MSxcImlzUnVsZXJPblwiOmZhbHNlLFwidWlcIjpcIlwifSJ9",
  "editor.cursorBlinking": "solid",
  "editor.fontWeight": "normal",
  "window.closeWhenEmpty": true,
  "workbench.colorTheme": "Monokai Pro (Filter Machine)",
  "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
  "zenMode.fullScreen": false,
  "[jsonc]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "search.exclude": {
    "*.code-workspace": true
  },
  "editor.minimap.maxColumn": 160,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "eslint.format.enable": true,
  "prettier.useEditorConfig": false,
  "editor.cursorStyle": "line",
  "editor.insertSpaces": false,
  "editor.wordSeparators": "/\\()\"':,.;<>~!@#$%^&*|+=[]{}`?-",
  "security.workspace.trust.untrustedFiles": "open",
  "php-cs-fixer.executablePath": "${extensionPath}/php-cs-fixer.phar",
  "php-cs-fixer.lastDownload": 1636083853463,
  "docthis.dateTagFormat": "yyyy/mm/dd",
  "docthis.includeAuthorTag": true,
  "docthis.authorName": "houdunren.com",
  "docthis.includeTypes": false,
  "docthis.inferTypesFromNames": true,
  "sync.forceUpload": true,
  "sync.autoUpload": true,
  "sync.gist": "0426cd087b8f877ccad26287242d2708",
  "editor.inlayHints.fontSize": 18,
  "editor.suggestFontSize": 18,
  "editor.renderLineHighlight": "all",
  "vetur.experimental.templateInterpolationService": true,
  "javascript.validate.enable": false,
  "terminal.integrated.fontSize": 16,
  "editor.linkedEditing": true,
  "editor.scrollbar.vertical": "hidden",
  "editor.scrollbar.horizontal": "hidden",
  "winopacity.opacity": 100,
  "debug.console.fontSize": 16,
  "files.associations": {
    "*.vue": "vue"
  },
  "volar.icon.preview": true,
  "window.zoomLevel": 3,
  "emmet.showSuggestionsAsSnippets": true,
  "editor.suggest.showStatusBar": true,
  "editor.suggestSelection": "first",
  "editor.inlineSuggest.enabled": true,
  "vetur.format.options.tabSize": 4
}

项目配置

下面是使用 Project Manager 插件的项目配置内容。

[
  {
    "name": "larave-blog",
    "rootPath": "/Users/hd/app/laravel-blog",
    "paths": [],
    "tags": [],
    "enabled": true
  },
  {
    "name": "vue3",
    "rootPath": "/Users/hd/edu/video/vue3/slot",
    "paths": [],
    "tags": [],
    "enabled": true
  },
  {
    "name": "houdunren",
    "rootPath": "/Users/hd/houdunren/houdunren.code-workspace",
    "paths": [],
    "tags": [],
    "enabled": true
  },
  {
    "name": "note",
    "rootPath": "/Users/hd/note",
    "paths": [],
    "tags": [],
    "enabled": true
  }
]