- Press CTRL-H ( ⌥⌘F on Mac ).
- Press ALT-R ( ⌥⌘R on Mac ).
- Type
_([a-zA-Z]). - Press TAB and type
$1. - Press ALT-ENTER ( ⌥ENTER on Mac ).
- Press F1 and type
upper, then press ENTER. - Press CTRL-ALT-ENTER ( ⌥ENTER on Mac ).
VS Code (and Atom) currently use JavaScript-style regular expressions for the find/replace feature so the replace operation doesn't support switches that are available in other editors like Vim (example: \u\1) or Sublime Text (example: $1-\L$1\E).
The workflow above will achieve the same results.
If you add the following to your keybindings.json then this becomes a keyboard shortcut (
ctrl+shift+kin this case)To get to this file click
ctrl+shift+pand typekeyboardselect
Open Keyboard Shortcut (JSON)after the last curly bracket (
}) in this file add a comma (,) so the last 2 lines of your file should look like this:to add a new keyboard shortcut paste the following after the comma you just added but before the square bracket (
]):Now when you press
ctrl+shift+kin a file it will run the snake case to lowerCamelCase conversion.