Reputation: 506
I've started using Visual Studio Code on MacOS.
Jumping with Alt+Left/Right is really annoying as it jumps by full identifier instead of just a word.
Examples:
I'd like e.g. Ctrl+Right to do the thing above and to modify the behaviour of Alt+Right so it jumps by word.
My desired behaviour:
Solution:
My final keybindings.json
config with the added Shift (select) options:
[
{
"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"
},
]
Upvotes: 37
Views: 22387
Reputation: 181379
You are looking for
cursorWordPartRight
which is bound to Shift-Alt-Q.
Alt-Right is bound to a "Go Forward
" command, you could delete that binding and use it for the cursorWordPartRight
command.
{
"key": "alt+right",
"command": "cursorWordPartRight",
"when": "editorTextFocus",
},
{
"key": "alt+left",
"command": "cursorWordPartLeft",
"when": "editorTextFocus",
}
It may require that each language parser support it though. It does work in JavaScript.
cursorWordPartLeft (command exists but is unbound by default).
There are also these other unbound relevant commands:
cursorWordPartRightSelect
cursorWordPartLeftSelect
cursorWordPartStartLeft
cursorWordPartStartLeftSelect
Upvotes: 52