visual-studio-codekey-bindings

VS Code - Move the cursor between 'k' and 'O' in the word "stackOverflow"


I want to move the cursor in to next Uppercase letter in a word like between e and C in the word googleChrome with a keyboard shortcut. We all tend to use variables with two words as twoWords instead of two_words. So, It would be really helpful if we can move the cursor between the word without pressing the arrow key a lot of times.

In Sublime Text, I can use Alt + Right or Alt + Left to do that. But in Visual Studio Code, I am not able to use Alt + Right or Alt + Left shorcut to do that.

I would also like to know how to convert two_words to twoWords with a shortcut in Visual Studio Code if it is possible.

Any help is appreciated. Thanks.


Solution

  • Go to File -> Preferences -> Keyboard Shortcuts and search for: "cursorWordPartLeft" and "cursorWordPartRight" and bind them to any key that you want. They should do what you want

    Mac example of swapping the word and word part behaviors:

    screenshot of the Keyboard Shortcuts settings panel with keys reassigned