安装
在vscode 中安装 VSpaceCode
配置
- settings.json
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["", ";"],
"commands": ["vspacecode.space"]
}
]
如果我们只在 settings.json 里配置,那么如果我们离开代码编辑区域的话,去到了资源管理器和终端就不起效了,所以我们需要再配置 keybindings.json
- keybindings.json
{
"key": "space",
"command": "vspacecode.space",
"when": "activeEditorGroupEmpty && focusedView == '' && !whichkeyActive && !inputFocus"
},
// Trigger vspacecode when sidebar is in focus
{
"key": "space",
"command": "vspacecode.space",
"when": "sideBarFocus && !inputFocus && !whichkeyActive"
},
操作文件相关的命令 f
操作git相关的命令 g
操作窗口相关的命令 w
比如:空格 + ; + f
注意 唤起 vspaceCode 窗口必须在英文状态下
在原有基础上修改
修改/增加
有这个keys 就是修改,没有就是增加
修改 g 下面的 s 命令
- settings.json
"vspacecode.bindingOverrides": [
{
// g 命令下的 s,也可以是数组形式 keys: ["g","s"]
"keys": "g.s",
// name 显示的名称
"name": "Go to line",
// 类型:命令
"type": "command",
// command 对应 vscode 里的命令id
"command": "workbench.action.gotoLine"
}
]
删除
只需要把对应的 keys 的 postion 写成 -1
{
"keys": "g.s",
"position": -1
}
重写
重写 g 里的所有命令,在我们的 g 里只写一个 g
{
"keys": "g",
"name": "Go...",
"type": "bindings",
"bindings": [
{
"key": "g",
"name": "Go to",
"type": "command",
"command": "workbench.action.gotoLine"
}
]
}
自定义自己的
区别 这里第一层也是 key 不是 keys
{
"key": "g",
"name": "Go..",
"type": "bindings",
"bindings": [
{
"key": "g",
"name": "Go to",
"type": "command",
"command": "workbench.action.gotoLine"
}
]
}
扩展
不喜欢弹窗的话 可以⾃⼰配置 vim
github.com/VSpaceCode/VSpaceCode/tree/
vscode-vim