MacOS – Use shift to select word until next capital letter


I am programming and from Windows I'm used to use the "shift" + "alt" + "arrow key right/left" keys to select a part from a word until the next capital letter starts. But on my Mac this shortcut only selects the whole word. Can this be done somehow on a Mac too?

For example:

myVariable (is the text to select, cursor is at the beginning (before 'm')).

Now using the shortcut "shift" + "alt" + "arrow key right" would select only 'my':

myVariable ('my' is selected, pressing it again would then select the whole word.)

This is a shortcut often needed for example when programming using the programming language Java.

Best Answer

I found a solution to my problem, but it only works for the IDE (development environment) I am using, which is the program IntelliJ IDEA, and not system wide. But that fits my needs.


Go to Preferences > Keymap > Search for "move caret to" > Select "Move Caret to Next Word in Different "Camel Humps" Mode" > Double Click it and select "Add keyboard shortcut" > Enter any shortcut you want.

You may also set a shortcut for doing the same thing but in the different direction.