underscore_case in PhpStorm thanks to vim
March 25, 2015
The power of Vim strikes again.
ideavim and PhpStorm
The ideavim plugin for PhpStorm is a powerful addition to the IDE but it can work wonders when tapping into the concise, although cryptic, power Vim can pack. Specifically PhpStorm offers the possibility to create, for a class protected or private properties, getters and setters in a simple swoop; convenient.
But WordPress
While the rest of the PHP world thrives in the camelCase notation WordPress uses snake_case notation for any function, variable or class name; I'm not fanatic about coding standards when that's decreasing coding speed but I like to keep the casing consistent.
To be able to tap into the possibility offered by PhpStorm and stick to snake_casing naming convention the following shortcut will allow for instant transformation from camelCase to snake_case:
:s#\C\(\<\u[a-z0-9]\+\|[a-z0-9]\+\)\(\u\)#\l\1_\l\2#g
the code above is not of my fabrication but comes from the Vim Wiki and works exactly as it's supposed to work in PhpStorm too.
[](http://theaveragedev.local/wordpress/wp-content/uploads/2015/03/2015-03-25-at-23.14.png)
[](http://theaveragedev.local/wordpress/wp-content/uploads/2015/03/2015-03-25-at-23.14-2.png)
While editing intentions would be easier that's still a working solution.