{"id":772,"date":"2012-11-15T08:16:44","date_gmt":"2012-11-15T15:16:44","guid":{"rendered":"http:\/\/www.curtisgibby.com\/blog\/?p=772"},"modified":"2016-05-11T06:39:40","modified_gmt":"2016-05-11T12:39:40","slug":"like-using-a-shotgun-to-kill-a-fly","status":"publish","type":"post","link":"https:\/\/www.curtisgibby.com\/blog\/2012\/11\/like-using-a-shotgun-to-kill-a-fly\/","title":{"rendered":"Like using a shotgun to kill a fly"},"content":{"rendered":"<p>For years, I&#8217;ve been using programs to replace small snippets of text in my programming. I type<\/p>\n<pre>`z<\/pre>\n<p>and the program outputs<\/p>\n<pre>cd \/var\/replicate\/Replicate\/trunk\/app<\/pre>\n<p>and hits enter for me. This is much faster than typing out the whole path (even with Bash tab completion), or password, or chunk of code (whatever I happen to have in that shortcut).<\/p>\n<p><!--more--><\/p>\n<p>I had a few dozen of these quick key replacements that probably saved me hundreds or thousands of hours over the years. The backtick character ` was great for triggering them, since it hardly ever gets used otherwise, even in programming, where you&#8217;re constantly using other generally-obscure symbols like &amp;*{}[]|. I had quite the muscle memory built up for my various shortcuts. I could hit<\/p>\n<pre>`1`6<\/pre>\n<p>in quick succession and know that I&#8217;d get a debug of the variable in my clipboard, followed by an exit statement.<\/p>\n<p>I started with the decent <a href=\"http:\/\/www.shortkeys.com\/\" target=\"_blank\">ShortKeys<\/a> program (which was where I picked up the habit of using backtick as a trigger), then a couple of years ago I got tired of its nag-ware reminders and moved over to the excellent free <a href=\"http:\/\/lifehacker.com\/238306\/lifehacker-code-texter-windows\" target=\"_blank\">Texter<\/a> (from Lifehacker&#8217;s Adam Pash). But when I got a new 64-bit Windows 7 system at home, quickly followed by a 64-bit Win8 setup at work, I realized that Texter has severe problems on 64-bit systems. My main problem was that <a href=\"https:\/\/github.com\/adampash\/texter\/issues\/4\" target=\"_blank\">regular Windows drag-and-drop operations were being blocked<\/a>, plus sometimes key combinations weren&#8217;t being triggered, and sometimes I&#8217;d get double text lliikkee tthhiiss.<\/p>\n<p>So I went looking for a 64-bit compatible replacement for Texter. Most of the <a href=\"http:\/\/www.w7forums.com\/text-replacement-t8049.html\" target=\"_blank\">suggestions<\/a> were to <a href=\"http:\/\/superuser.com\/questions\/166678\/list-of-utilties-similar-to-lifehackers-texter\" target=\"_blank\">use AutoHotkey<\/a>, but I considered that overkill. I didn&#8217;t need to remap complete Windows key combinations or simulate mouse clicks, just do a little text-replacement.<\/p>\n<p>I tried a couple of other programs that didn&#8217;t work out: <a href=\"http:\/\/www.phraseexpress.com\/\" target=\"_blank\">PhraseExpress<\/a> (clunky, non-commercial use only) and <a href=\"http:\/\/www.donationcoder.com\/forum\/index.php?topic=23643\" target=\"_blank\">Auspex<\/a> (buggy, crashy) before coming back around to try AutoHotkey. I found that it was the perfect replacement for me &#8212; I learned how to use its scripting system to exactly replicate the shortcuts that I&#8217;d had in Texter, plus a lot more. Another nice thing is that its configuration is all text-based, so I don&#8217;t have to mess with a GUI to add another shortcut, and I can sync my configuration over Dropbox. I still think that it&#8217;s overkill (like using a shotgun to kill a fly), but it&#8217;s the best solution I&#8217;ve found.<\/p>\n<p>Here&#8217;s my configuration:<\/p>\n<p><code><br \/>\n:*:``\\::- Curtis<br \/>\n:*:``-::[sensitive string]<br \/>\n:*:``1::echo \"^v : \" pr($^v); \/\/ debug{!}<br \/>\n:*:``6::exit(); \/\/ debug{!}<br \/>\n:*:``9::soundconcepts.com<br \/>\n:*C:``*::[sensitive string]<br \/>\n:*C:``$::[sensitive string]<br \/>\n:*C:``a::apache2ctl -k graceful{Enter}<br \/>\n:*C:``ba::Bad Apostrophe<br \/>\n:*C:``bna::Bad Non-Apostrophe<br \/>\n:*C:``C::cgibby<br \/>\n:*C:``c::curtis<br \/>\n:*C:``e::[sensitive string]<br \/>\n:*C:``m::@mailinator.com<br \/>\n:*C:``o::cd \/var\/orderform\/ordersystem\/trunk\/{Enter}<br \/>\n:*C:``p::<!--?php?-->&lt;?php ?&gt;{Left}{Left}<br \/>\n:*C:``P::[sensitive string]<br \/>\n:*C:``r::rm tmp\/cache\/models\/{Enter}rm tmp\/cache\/persistent\/{Enter}<br \/>\n:*C:``t::[sensitive string]<br \/>\n:*C:``W::cd \/var\/welcomekit\/app\/{Enter}<br \/>\n:*C:``w::[sensitive string]<br \/>\n:*C:``x::svn update{Enter}<br \/>\n:*C:``Z::\/var\/zijaweb\/app{Enter}<br \/>\n:*C:``z::cd \/var\/replicate\/Replicate\/trunk\/app{Enter}<br \/>\n::functino::function<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>For years, I&#8217;ve been using programs to replace small snippets of text in my programming. I type `z and the program outputs cd \/var\/replicate\/Replicate\/trunk\/app and hits enter for me. This is much faster than typing out the whole path (even with Bash tab completion), or password, or chunk of code (whatever I happen to have&hellip; <a class=\"more-link\" href=\"https:\/\/www.curtisgibby.com\/blog\/2012\/11\/like-using-a-shotgun-to-kill-a-fly\/\">Continue reading <span class=\"screen-reader-text\">Like using a shotgun to kill a fly<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,17],"tags":[147,144,146,156,145,148,143,159],"class_list":["post-772","post","type-post","status-publish","format-standard","hentry","category-programming","category-work","tag-auspex","tag-autohotkey","tag-phraseexpress","tag-programming","tag-shortkeys","tag-text-replacement","tag-texter","tag-work","entry"],"_links":{"self":[{"href":"https:\/\/www.curtisgibby.com\/blog\/wp-json\/wp\/v2\/posts\/772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.curtisgibby.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.curtisgibby.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.curtisgibby.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.curtisgibby.com\/blog\/wp-json\/wp\/v2\/comments?post=772"}],"version-history":[{"count":6,"href":"https:\/\/www.curtisgibby.com\/blog\/wp-json\/wp\/v2\/posts\/772\/revisions"}],"predecessor-version":[{"id":811,"href":"https:\/\/www.curtisgibby.com\/blog\/wp-json\/wp\/v2\/posts\/772\/revisions\/811"}],"wp:attachment":[{"href":"https:\/\/www.curtisgibby.com\/blog\/wp-json\/wp\/v2\/media?parent=772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.curtisgibby.com\/blog\/wp-json\/wp\/v2\/categories?post=772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.curtisgibby.com\/blog\/wp-json\/wp\/v2\/tags?post=772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}