Another Macintosh keyboard shortcut that will be second nature to most Mac users is using ⌥← to move to the beginning of a word and ⌥→ to move to the end of a word. This moves the cursor to the left of the first character or the right of the last character. Try it in Mail. In TextEdit. In another editor you have installed like Sublime Text. It works the same across any Mac application I can think of except for PHPStorm. It feels so… wrong.
There is no existing Keymap setting in PHPStorm to move to the beginning and end of a word. Instead, there are command for moving to the next and previous words:
To fix this abomination, and affront to Clarus the Dogcow, you will need to install a PHPStorm plug-in called “Missing in Actions.” “Missing in Actions” actually will add quite a bit of functionality but, really, the thing that I was really looking for was the proper handling for ⌥← and ⌥→. Read more about Missing in Actions at the plug-in’s Github repository.
Go to PHPStorm > Preferences > Plugins. From there, choose “Browse Repositories.” Search for “Missing in Actions” and click the Install button. The plug-in will download and then you will be prompted to restart PHPStorm for the changes to take effect.
After restart is complete (you may have time to refresh your coffee), you will see new options available in the Keymap settings of PHPStorm:
- Move Caret to Next End of Word
- Move Caret to Previous Start of Word
Set these to ⌥→ and ⌥← and all will be well again.