Thanks to Visual Studio Code—Customizing word separators I was able to set underscore as separator. So now whenever I press Ctrl+Left Arrow, VS code recognizes that the word starts right after the underscore. However sometimes I want go at the very beginning of the variable/function/class name and, using underscore as separator, I have to press Ctrl+Left Arrow several times to get there. Is there any way to get a behavior like:
Another possible way for achieving the desired behaviour is through the following steps:
Exclude _
from the word separators in case you still have it included.
Add the two following keybindings
to your keybindings.json
:
{
"key": "ctrl+shift+left",
"command": "cursorWordLeft",
"when": "textInputFocus"
},
{
"key": "ctrl+left",
"command": "cursorWordPartLeft",
"when": "textInputFocus"
}
The first keybinding allows you to move to the left of a word by pressing Ctrl + Shift + Left Arrow.
The second keybinding allows you to move to the left of a word by pressing Ctrl + Left Arrow but considering _
this time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With