I've been using TextExpander for a while and I absolutely love it. If you aren't familiar, TextExpander allows you to create shortcuts to frequently used pieces of text. Its a tool that everyone can use, but programmers like me find it especially useful. So much of our time as developers is spent in text editors and command prompts that any method that makes text entry easier is a very good thing.
In the past, I've used aliases inside my bash profile to pull these sorts of things off. I prefer using TextExpander these days because you can sync your snippets across all of your machines, it allows for cursor placeholders, and it allows you to tweak the command before executing.
Here are some of my favorite time-saving snippets for TextExpander:
Hard to Remember or Frequently Used Drush Commands
I have the hardest time remembering the exact syntax for so many of my most used Drush commands. I hit up the Drush documentation site at least once a day, but these snippets are helping reduce that frequency. Here's a list of some of my most used Drush snippets:
/** Clear Boost Cache **/
drush --uri=%| boost-cache-clear-all
/** Variable Get & Variable Set (% being the name of the variable to set/get) **/
drush vget %|
drush vset %|
/** Turn off CSS Aggregation **/
drush vset preprocess_css 0 --yes
/** Features Revert All and Clear All Caches **/
drush fra -y && drush cc all
In the above examples the "%|" is a placeholder for where the cursor will be positioned after the text is expanded. Love this feature.
h3. Linux/Unix Snippets
/** Copy Local SSH Key **/
pbcopy < ~/.ssh/id_rsa.pub
/** rsync command template **/
rsync -avzP /src/path/ /destination/path/
Using Client Numbers to Jump to Project Directories
At CHROMATIC, we assign a number to each of our clients. This helps us keep our files, directories milestones, calendars, etc. organized. For example, one client might have a client number of "0041". Anything related to that client will use that identifier. Locally, I have repos for all of the active client projects I'm working on at any given time. I'm very often switching between projects during the day and I'm always forgetting the paths to each of my project repos. So, I use TextExpander to store the absolute paths to all of my favorite projects and key them with the easy to remember client numbers. This allows me to type a few characters and get the proper "change directory" command very quickly.
Here's some examples:
Outside of project directories, I use this same trick for other dev related tools that are stored in different/obscure places on my mac. Like Solr for example:
Misc. & Other Ideas
Below is a list of miscellaneous items I have snippets for. Some are great just because they save me time, others because remembering their syntax gives me fits.
- Commonly used Drupal API functions/snippets
- Hard to remember Sass mixins and functions
- Blocks of common Drupal hooks like hook_menu(), hook_block(), hook_form_alter(), etc.
- Wedding Anniversary
How do you use TextExpander to speed up your workflow? Or better yet, what other tools do you use to make your life as a developer easier?