由于这个问题是针对“大”Visual Studio 和 Resharper,我也希望在 VS Code 中看到该功能。
滚动浏览 VS Code 的快捷方式列表,我找不到它,但我希望它仍然存在,但被称为比 camel、hump 等不太直观的东西。
我发现这个扩展可以工作https://marketplace.visualstudio.com/items?itemName=ow.vscode-subword-navigation
有趣的是,您需要单独配置每个组合:
{
"key": "alt+left",
"command": "subwordNavigation.cursorSubwordLeft",
"when": "editorTextFocus"
},
{
"key": "alt+right",
"command": "subwordNavigation.cursorSubwordRight",
"when": "editorTextFocus"
},
{
"key": "alt+shift+left",
"command": "subwordNavigation.cursorSubwordLeftSelect",
"when": "editorTextFocus"
},
{
"key": "alt+shift+right",
"command": "subwordNavigation.cursorSubwordRightSelect",
"when": "editorTextFocus"
},
{
"key": "alt+backspace",
"command": "subwordNavigation.deleteSubwordLeft",
"when": "editorTextFocus"
},
{
"key": "alt+delete",
"command": "subwordNavigation.deleteSubwordRight",
"when": "editorTextFocus"
}
如果由于某些原因你的绑定没有设置,这里是获取 Cezn 快捷方式的 JSON。
{
"key": "ctrl+alt+right",
"command": "cursorWordPartRight",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+shift+right",
"command": "cursorWordPartRightSelection",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+left",
"command": "cursorWordPartLeft",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+shift+left",
"command": "cursorWordPartLeftSelection",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+backspace",
"command": "deleteWordPartLeft",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+alt+delete",
"command": "deleteWordPartRight",
"when": "editorTextFocus && !editorReadonly"
}
请小心使用 ctrl+alt+delete,因为它与另一种流行的 Windows 快捷方式冲突。
其他有趣的绑定是:
{
"key": "ctrl+n",
"command": "explorer.newFile",
"when": "explorerViewletFocus"
},
{
"key": "ctrl+shift+n",
"command": "explorer.newFolder",
"when": "explorerViewletFocus"
}
为此有一个扩展:Camel Case Navigation
调整了这个答案,使其适用于 v1.91
{
"key": "alt+right",
"command": "cursorWordPartRight",
"when": "editorTextFocus"
},
{
"key": "alt+shift+right",
"command": "cursorWordPartRightSelect",
"when": "editorTextFocus"
},
{
"key": "alt+left",
"command": "cursorWordPartLeft",
"when": "editorTextFocus"
},
{
"key": "alt+shift+left",
"command": "cursorWordPartLeftSelect",
"when": "editorTextFocus"
},
{
"key": "alt+backspace",
"command": "deleteWordPartLeft",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "alt+delete",
"command": "deleteWordPartRight",
"when": "editorTextFocus && !editorReadonly"
}