首页 > 其他分享 >vscode vim keybinds.json vscode的按键配置

vscode vim keybinds.json vscode的按键配置

时间:2022-10-04 14:45:34浏览次数:47  
标签:commands vscode workbench vim json key action before

vscode的keybindings.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"
  },
  // 切换到文件浏览器,可以在任何位置,主要是在terminal终端
  {
    "key": "ctrl+;",
    "command": "workbench.view.explorer",
    "when": "viewContainer.workbench.view.explorer.enabled"
  },
  // 切换到代码编辑区,不论在任何位置
  {
    "key": "ctrl+'",
    "command": "workbench.action.focusFirstEditorGroup"
  },
  // 在文件夹资源管理器中新建一个文件
  {
    "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"
  }
]

settings.json

{
  "vim.leader": "<space>",
  "vim.useSystemClipboard": true,
  "vim.hlsearch": true,
  "vim.highlightedyank.enable": true,
  "vim.foldfix": true,
  "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"
      ]
    },
    // quick open
    {
      "before": [
        "<leader>",
        "f",
        "f"
      ],
      "commands": [
        "workbench.action.quickOpen"
      ]
    },
    // find char in files
    {
      "before": [
        "<leader>",
        "f",
        "c"
      ],
      "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"
      ]
    },
    // 上下左右的移动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": [
        "<leader>",
        "n"
      ],
      "commands": [
        "workbench.action.nextEditor"
      ]
    },
    // 移动到上一个编辑器标签
    {
      "before": [
        "<leader>",
        "p"
      ],
      "commands": [
        "workbench.action.previousEditor"
      ]
    }
  ],
  "vim.insertModeKeyBindings": [
    // 退出插入模式
    {
      "before": [
        "j",
        "k"
      ],
      "after": [
        "<Esc>"
      ]
    }
  ],
  "vim.visualModeKeyBindingsNonRecursive": [
    // 移动到非空字符的行首
    {
      "before": [
        "H"
      ],
      "after": [
        "^"
      ]
    },
    // 移动到非空字符的行尾
    {
      "before": [
        "L"
      ],
      "after": [
        "$"
      ]
    }
  ],
  "vim.digraphs": {},
  "vim.commandLineModeKeyBindings": [],
}

标签:commands,vscode,workbench,vim,json,key,action,before
From: https://www.cnblogs.com/zhuoss/p/16753725.html

相关文章

  • Vim配置
    唯快不破--VimcolorschemeronhiTabLineFillctermbg=greysetnusetrulersetmouse=asetts=4setnoswapfilesetautoindentsetstatusline=DelovueautocmdV......
  • python在VScode中中文输出乱码的解决方案
    ————————————————版权声明:本文为CSDN博主「Rhett.Yao」的原创文章。原文链接:https://blog.csdn.net/m0_63109538/article/details/126419637——————......
  • vim设置
    "Configurationfileforvimsetmodelines=0"CVE-2007-2438"Normallyweusevim-extensions.Ifyouwanttruevi-compatibility"removechangethe......
  • vscode插件REST Client,替代postman
    如果只是简单的请求工作的话,这个插件也许跟方便使用方式准备工作安装该插件创建一个test.http(名字随意,后缀.http)文件朴素的请求后面必须有协议版本号HTTP/1.1......
  • python jsonpath 替换json 指定字段
    1. pass 2.  pass......
  • FastJson---高性能JSON开发包
    SVN:​​http://code.alibabatech.com/svn/fastjson/trunk/​​​WIKI:​​http://code.alibabatech.com/wiki/display/FastJSON/Home​​pom.xml文件中加入依赖依赖:<depend......
  • 感慨 vscode 支持win7最后一个版本 1.70.3 于2022年7月发布
    为什么家里电脑一直是win7,也懒的升级,nodejs也不能用最新的,没想到vscode也停产了https://code.visualstudio.com/updates/v1_70......
  • javaScript--5 javascript json字符串转换
      <!DOCTYPEhtml><html><head><title>JavaScript对象转JSON字符串</title></head><body><script>varjsonObj={"userId":"admin",......
  • vscode中快速声明数据类型
    如何快速声明数据类型上面这张图letobj1=reactive({listArr:[],backArr:[{name:'张三',age:10,info:'本科'}],age:100,name:'',flag:......
  • vscode gif 设置扫描深度
    一个项目下,分为多个GIT仓库,如果都是在根目录下没有问题,VSCODE会自动扫出GIT库但是如果有一些仓库在其它子目前下,如果不设置VSCODE是不能扫出来总共四个仓库:根目录有2个仓库p......