Posted on

Speed Coding With phpStorm and WASD Keyboards

WASD Keyboard In Action

I’ve been coding a LOT more than usual over the past 3 weeks.    So much so that I’ve started having issues with my wrist, likely early onset of carpal tunnel which I would prefer to avoid.    I did a few things today to help offset that.

WASD Keyboard

The first was to buy an 87-key CODE keyboard from WASD.   This allows me to move my mouse a lot closer to “center” on my desktop.  Since I rarely use the numeric keypad or media keys, this is a good trade-off.  “Cut off” the numeric keypad and make the keyboard a lot narrower.   I’m not sure if I like the old-school clackety-clack of the Cherry MX Brown switches, but it has a great feel so I may get used to it.     Great backlighting as well.

WASD Keyboard In Action
WASD Keyboard In Action

One downside that I’ve already discovered is that the CTRL key through ALT key on the left side are more than a half-key position to the left of my old keyboard.  That makes the “reach” for CTRL-V (paste) keystrokes further apart than I like.    On the plus side, the full size / full travel keys have me looking down to validate my keystrokes far less often.  Overall I feel like I am typing much more quickly on this keyboard.  Amazing how much the tactile feel makes a difference in that regard.

New keyboard, less right-wrist travel especially for the mouse.   With another service launch coming this fall I expect a lot more coding; hopefully this change will eliminate the potential for carpal tunnel.

phpStorm Tricks

The other thing I did when getting the new keyboard, mostly due to changes in the keys that OSX recognizes, is setup some keyboard shortcuts in phpStorm.    I also learned some neat shortcuts I need to add to my daily routines.  Here are two of the most productive shortcuts that have my hitting a LOT fewer keys.

^Y = delete a line

This is going to save me from the old-habit ctrl-left-arrow , ctrl-shift-right-arrow, delete keystroke.   8 keystrokes down to 2.  Wish I discovered that one long ago.

Live Templates

This is HUGE.  Why didn’t I know about this 2 years ago?   What is a live template?   It can be a lot of things, but my simple version is using it as a permanently-saved copy & paste buffer for text I type frequently, especially during debugging.

What this does is sets up an auto-complete hint when you type in certain snippets of text (abbreviations).    For example, I have an echo statement I use when doing “quick & dirty debugging” in phpStorm.  It is faster than xdebug and all that complexity.    I have been manually typing in this long echo statement for years, something like echo “====== ” . get_class() . ‘::’ . __FUNCTION__ . “<br/>\n”;

I highlight that code, and select “Tools/Live Template”.    I then assign a shortcut, in my case I chose ‘ecof’ so it does not conflict with other PHP auto-complete hints.   Now I can simply type ecof-tab in phpStorm and it will auto-complete the line , replacing ecof with the entire echo statement above.

Cool, right?!


Now if phpStorm would just fix their newly-introduced “feature” in version 9 so I can get back the extra keystrokes I have to type every time I end a phpDoc comment line with a period (<sarcasm>which NEVER happens </sarcasm>) and they decide to auto-complete that as “.@deprecated”.


Coding Smarter…

Way less typing.  Faster code.  Less carpal tunnel.

I call that a win for today.