VScode 快捷键文件记录(keybindings.json)

2024-01-18  本文已影响0人  狼少丷
// 将键绑定放在此文件中以覆盖默认值auto[]
// 自己使用习惯, 类似与Android studio 或者idea . 系统是Win 
// 包括行注释自动换行, 文件注释, 方法注释, 行删除, 区域选择展开, 代码上下移动等
// 将键绑定放在此文件中以覆盖默认值auto[]
[
    { 
        "key": "ctrl+y",
        "command": "-redo"
    },
    {//适配VScode注释只能一行一行进行, 这里的注释会自行到下一行
        "key": "ctrl+/",
        "command": "extension.multiCommand.execute",
        "args": {
          "sequence": [
            "editor.action.commentLine",
            "cursorDown"
          ]
        },
        "when": "editorTextFocus"
      },
    {  //删除当前一行
        "key": "ctrl+y",
        "command": "editor.action.deleteLines",
        "when": "textInputFocus && !editorReadonly"
    },
    {
        "key": "ctrl+shift+k",
        "command": "-editor.action.deleteLines",
        "when": "textInputFocus && !editorReadonly"
    },
    {
        "key": "ctrl+alt+l",
        "command": "editor.action.formatDocument",
        "when": "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly && !inCompositeEditor"
    },
    {
        "key": "shift+alt+f",
        "command": "-editor.action.formatDocument",
        "when": "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly && !inCompositeEditor"
    },
    {
        "key": "ctrl+alt+l",
        "command": "editor.action.formatDocument.none",
        "when": "editorTextFocus && !editorHasDocumentFormattingProvider && !editorReadonly"
    },
    {
        "key": "shift+alt+f",
        "command": "-editor.action.formatDocument.none",
        "when": "editorTextFocus && !editorHasDocumentFormattingProvider && !editorReadonly"
    },
    { // 向下复制当前行
        "key": "ctrl+d",
        "command": "-editor.action.addSelectionToNextFindMatch",
        "when": "editorFocus"
    },
    { 
        "key": "ctrl+d",
        "command": "editor.action.copyLinesUpAction",
        "when": "editorTextFocus && !editorReadonly"
    },
    { 
        "key": "shift+alt+up",
        "command": "-editor.action.copyLinesUpAction",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+shift+oem_2",
        "command": "editor.action.blockComment",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "shift+alt+up",
        "command": "-notebook.cell.copyUp",
        "when": "notebookEditorFocused && !inputFocus"
    },
    { // 向上移动当前行
        "key": "shift+alt+up",
        "command": "editor.action.moveLinesUpAction",
        "when": "editorTextFocus && !editorReadonly"
    },
    {  
        "key": "shift+alt+down",
        "command": "-editor.action.copyLinesDownAction",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "shift+alt+down",
        "command": "-notebook.cell.copyDown",
        "when": "notebookEditorFocused && !inputFocus"
    },
    {  // 向下移动当前行
        "key": "shift+alt+down",
        "command": "editor.action.moveLinesDownAction",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "alt+up",
        "command": "-editor.action.moveLinesUpAction",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "alt+down",
        "command": "-editor.action.moveLinesDownAction",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "f8",
        "command": "editor.action.rename",
        "when": "editorHasRenameProvider && editorTextFocus && !editorReadonly"
    },
    {
        "key": "f2",
        "command": "-editor.action.rename",
        "when": "editorHasRenameProvider && editorTextFocus && !editorReadonly"
    },
    { //最近的错误, 再次按下寻找下一个错误
        "key": "f2",
        "command": "editor.action.marker.nextInFiles",
        "when": "editorFocus"
    },
    {
        "key": "f8",
        "command": "-editor.action.marker.nextInFiles",
        "when": "editorFocus"
    },
    { // 相对的上一个错误
        "key": "shift+f2",
        "command": "editor.action.marker.prevInFiles",
        "when": "editorFocus"
    },
    {
        "key": "shift+f8",
        "command": "-editor.action.marker.prevInFiles",
        "when": "editorFocus"
    },
    {
        "key": "ctrl+w",
        "command": "-workbench.action.closeActiveEditor"
    },
    {
        "key": "ctrl+w",
        "command": "-workbench.action.terminal.killEditor",
        "when": "terminalEditorFocus && terminalFocus && terminalHasBeenCreated || terminalEditorFocus && terminalFocus && terminalProcessSupported"
    },
    {
        "key": "ctrl+w",
        "command": "-workbench.action.closeGroup",
        "when": "activeEditorGroupEmpty && multipleEditorGroups"
    },
    {
        "key": "alt+w",
        "command": "-toggleSearchEditorWholeWord",
        "when": "inSearchEditor && searchInputBoxFocus"
    },
    {
        "key": "alt+w",
        "command": "-workbench.action.terminal.toggleFindWholeWord",
        "when": "terminalFindFocused && terminalHasBeenCreated || terminalFindFocused && terminalProcessSupported || terminalFocusInAny && terminalHasBeenCreated || terminalFocusInAny && terminalProcessSupported"
    },
    {
        "key": "alt+w",
        "command": "-toggleFindWholeWord",
        "when": "editorFocus"
    },
    {
        "key": "alt+w",
        "command": "-toggleSearchWholeWord",
        "when": "searchViewletFocus"
    },
    { // 扩张选择
        "key": "alt+w",
        "command": "editor.action.smartSelect.expand",
        "when": "editorTextFocus"
    },
    {  //与上面的相反, 收缩选择
        "key": "shift+alt+w",
        "command": "editor.action.smartSelect.shrink",
        "when": "editorTextFocus"
    },
    { // 查找文本, 继续按查找下一个
        "key": "ctrl+f",
        "command": "editor.action.nextMatchFindAction",
        "when": "editorFocus && findInputFocussed"
    },
    { // 与上一个相反, 查找上一个
        "key": "ctrl+shift+f",
        "command": "editor.action.previousMatchFindAction",
        "when": "editorFocus && findInputFocussed"
    },
    { // 在光标下方新增一行
        "key": "shift+enter",
        "command": "editor.action.insertLineAfter",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+enter",
        "command": "-editor.action.insertLineAfter",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "alt+d",
        "command": "workbench.action.terminal.clear"
    },
    {
        "key": "ctrl+shift+u",
        "command": "-workbench.action.output.toggleOutput",
        "when": "workbench.panel.output.active"
    },
    { //变换法大写字母
        "key": "ctrl+shift+u",
        "command": "editor.action.transformToUppercase"
    },
    {  变换为小写字母
        "key": "ctrl+u",
        "command": "editor.action.transformToLowercase"
    },
    {
        "key": "ctrl+u",
        "command": "-cursorUndo",
        "when": "textInputFocus"
    },
    { //查询并替换
        "key": "ctrl+alt+f",
        "command": "editor.action.startFindReplaceAction",
        "when": "editorFocus || editorIsOpen"
    },
    {
        "key": "ctrl+h",
        "command": "-editor.action.startFindReplaceAction",
        "when": "editorFocus || editorIsOpen"
    },
    { // 配合自动生成文件或函数注释插件/ 生成函数注释
        "key": "ctrl+alt+1",
        "command": "extension.cursorTip",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+win+t",
        "command": "-extension.cursorTip",
        "when": "editorTextFocus"
    },
    { // 生成问价头注释
        "key": "ctrl+alt+2",
        "command": "extension.fileheader",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+win+i",
        "command": "-extension.fileheader",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+alt+oem_period",
        "command": "workbench.action.moveEditorToNextGroup"
    },
    {
        "key": "ctrl+alt+right",
        "command": "-workbench.action.moveEditorToNextGroup"
    },
    {
        "key": "ctrl+alt+oem_comma",
        "command": "workbench.action.moveEditorToPreviousGroup"
    },
    { 
        "key": "ctrl+alt+left",
        "command": "-workbench.action.moveEditorToPreviousGroup"
    },
    { // 当前行尾
        "key": "ctrl+alt+right",
        "command": "cursorEnd",
        "when": "textInputFocus"
    },
    { // 当前行首
        "key": "ctrl+alt+left",
        "command": "cursorHome",
        "when": "textInputFocus"
    },
    {
        "key": "ctrl+alt+o",
        "command": "-workbench.action.remote.showMenu"
    },
    {  
        "key": "ctrl+alt+t",
        "command": "commentTranslate.replaceSelections",
        "when": "editorHasSelection"
    },
    {
        "key": "shift+alt+t",
        "command": "-commentTranslate.replaceSelections",
        "when": "editorHasSelection"
    },
    {
        "key": "ctrl+shift+t",
        "command": "-extension.yao.translate.show",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+alt+c",
        "command": "workbench.output.action.clearOutput"
    },
    {  //快速修复
        "key": "alt+enter",
        "command": "editor.action.quickFix",
        "when": "editorHasCodeActionsProvider && textInputFocus && !editorReadonly"
    },
    {
        "key": "alt+oem_2",
        "command": "editor.action.quickFix",
        "when": "editorHasCodeActionsProvider && textInputFocus && !editorReadonly"
    }
]

后续可能会继续更新~~~

上一篇 下一篇

猜你喜欢

热点阅读