7

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.

Sarvesh M.D
  • 192
  • 1
  • 11
  • You can try using the [Sublime Keymap](https://marketplace.visualstudio.com/items?itemName=ms-vscode.sublime-keybindings) if that's what you're comfortable with. And for converting case of a variable, again what you try is [Case Converter](https://marketplace.visualstudio.com/items?itemName=munyabe.CaseConverter) as VS-Code has built-in support for transforming to snake case but not camel case. – Debargha Roy Jun 18 '21 at 13:06
  • you can look if `Text Manipulator` by Adam Walzer does what you want in renaming – rioV8 Jun 18 '21 at 14:01
  • I found out the answer for that second question ! Pressing `Ctrl + Shift + P` which brings up the command pallette, and typing in `Transform to snake case` in the command pallette. You can set any keybinding for that by adding this to your keybindings.json file and replacing the `ctrl+k ctrl+;` to any shortcut you would like `{"key": "ctrl+k ctrl+;","command": "editor.action.transformToSnakecase"}` – Sarvesh M.D Jun 18 '21 at 14:22

1 Answers1

15

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

Costa
  • 1,794
  • 1
  • 12
  • 21