【发布时间】:2019-02-18 11:41:26
【问题描述】:
我已经开始在 MacOS 上使用 Visual Studio Code。
使用 Alt+Left/Right 跳转真的很烦人,因为它会按完整标识符而不是一个单词来跳转。
例子:
- ▼create_foo() Alt+右 create_foo▼()
- ▼createFoo() Alt+右 createFoo▼()
我想要例如Ctrl+Right 执行上述操作并修改 Alt+Right 的行为,使其逐字跳转.
我想要的行为:
- ▼create_foo() Alt+右 create_▼foo()
- ▼create_foo() Ctrl+右 create_foo▼()
解决方案:
我的最终keybindings.jsonconfig 添加了 Shift(选择)选项:
[
{
"key": "alt+left",
"command": "cursorWordPartLeft",
"when": "editorTextFocus",
},
{
"key": "alt+right",
"command": "cursorWordPartRight",
"when": "editorTextFocus",
},
{
"key": "shift+alt+left",
"command": "cursorWordPartLeftSelect",
"when": "editorTextFocus"
},
{
"key": "shift+alt+right",
"command": "cursorWordPartRightSelect",
"when": "editorTextFocus"
},
{
"key": "ctrl+left",
"command": "cursorWordStartLeft",
"when": "editorTextFocus"
},
{
"key": "ctrl+right",
"command": "cursorWordEndRight",
"when": "editorTextFocus"
},
{
"key": "shift+ctrl+left",
"command": "cursorWordStartLeftSelect",
"when": "editorTextFocus"
},
{
"key": "shift+ctrl+right",
"command": "cursorWordEndRightSelect",
"when": "editorTextFocus"
},
]
【问题讨论】:
-
有人对使用
vscode 1.43.2和macOS Catalina 10.15.1的ctrl快捷方式有问题吗?不包括ctrl的任何其他键绑定都可以...