How I Can Code Twice As Fast As You
videos

How I Can Code Twice As Fast As You

We’re all familiar with text expander programs; though I would surmise that the percentage of us who use them when coding is quite low. To change things up a bit, today I’m going to you how to create custom text-expander scripts that will save you a great deal of time. If you’re unfamiliar with such programs, you must watch this! After reviewing the screencast and tutorial, I’d love to hear how you save time when developing.

Okay – so I’m mostly teasing with this article’s title. Many, many techniques factor into writing quick and efficient code. Nevertheless, you’ll be astounded at how much time you can potentially save by using a simple text-expanding program. Watch the screencast below to learn one of my tricks.

Why Use a Text Expander?

How many times have you typed the following:

<script type="text/javascript" src="js/somefile.js"></script>

<script type="text/javascript">
...my code
</script>

Granted, it only takes ten seconds or so, but imagine multiplying that figure by 100. How much time can you potentially save by assigning a simple keystroke to a block of code? With a text-expanding program, I can simply type “startjs” (or any other key that I define), and press tab. Once I do, all of the code above will be pasted in.

Many IDEs offer a snippets section. Definitely utilize these for more complicated procedures. However, it’s important to keep in mind that Texter works anywhere. It’s not dependent upon one specific program.

How Fast?

As an example, I took a 100% blank page and was able to create all of the code below in about ten seconds, without copying and pasting. I utilized about five snippets.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="css/default.css" />
<link rel="stylesheet" href="css/reset.css" />
<title>Untitled Document</title>
</head>

<body

<div id="container">
	<form method="" action="">
		<label for="name">Name</label><input type="text" name="name" id="name" />
		<label for="name">Email</label><input type="text" name="email" id="email" />
		<input type="submit" name="submit" value="Submit" />
	</form>
	
	<p>
		Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
		Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure 
		dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non 
		proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
	</p>
</div><!--end container-->

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">

$(function() {

});

</script>

</body>
</html>

What You Need to Get Started

Your best option is to do a Google search for “free text expander”. There are plenty of pay versions, but if you look hard enough, you should be able to find a few apps that will work perfectly. Here are some worth consideration.

Out of the options listed above, only “Texter” is 100% free. The other two offer a free 30-day trial. If any of you have other options, leave a comment and I will update this list. For this tutorial, we’ll be using Texter (Windows), but most of the techniques can be easily translated into a different piece of software.

How Do I Use It?

Texter

It’s easy! Grab a block of code and paste it into your clipboard. Try to keep the code as general as possible; that way you won’t have to modify it too much. Open Texter, or your expander of choice, and choose a unique key. Next, paste in your code – and you’re done! To test it, return to your document, type in your key and press tab!

What Else Would I Use it For?

I literally have dozens of shortcuts assigned – ranging from simple snippets to more complicated scripts (which you’ll learn about in the screencast). Some of my favorites are listed below:

Import jQuery

// Typing jquery + tab gives me:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

Open Inline Javascript Stuff

// Typing beginjq + tab gives me:
<script type="text/javascript"><script>
   $(function() {

   });
</script>

Insert Lipsum Text


Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure 
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non 
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Simple Conveniences

Don’t forget about the simple three second timesavers. Those add up quickly over the course of a week!


<img src="" alt="" />

If we’ll spend an extra minute or so, we can write a quick script that will position the cursor between the “src” quotation marks. (Remember – the goal is to touch the mouse as little as possible.) Change the option in Texter from “Text” to “Script”, and paste in the following:

<img src="" alt="" />^{LEFT}^{LEFT}^{LEFT}{LEFT}{LEFT}

In this little script, We add our image tag, and then use a combination of “Control Left” and “Left” to place our cursor correctly.

  • ^ = Control
  • + = Shift
  • # = Windows Key
  • ! = Alt

  • {TAB} = tab key
  • {BS} = backspace key
  • {LEFT} = left arrow key
  • {HOME} = home key
  • …etc.

Tutorial Writing!

Any time that we post a tutorial on nettuts+ that contains scripts, we must add the correct “name” and “class” attributes to our pre tags. This allows for the syntax highlighting. For example…

<pre name="code" class="html">
author's script goes here...
</pre>

As you can imagine, it can be a pain to type, or even copy and paste, those wrapping pre tags fifteen times per article. Sounds like a great usage for text expanding! However, just inserting that snippet into our program of choice isn’t enough. We need to add a simple script. The following will work for Texter; just make sure that you’ve selected the “Script” option, rather than “Text”.

<pre name="code" class="">{ENTER}{ENTER}</pre>{UP}

When we wish to tell Texter to perform a specific keystroke, we simply wrap the name of the key within braces. For example, when I typed {UP} at the very end, I did so because I wanted the cursor to ultimately end up between the two pre tags, not after.


<pre name="code" class="html">
(cursor will be right here)
</pre>

Keep In Mind

You might have to tweak your scripts for your IDE of choice. Keep in mind that some IDEs apply automatic indentation, code completion, etc. This can screw up your scripts slightly. To compensate, it might be easiest to disable those features.

What Are Your Tricks?

I’m always on the lookout for shortcuts. It’s all about keeping your hourly wage as high as possible, without producing an inferior product. How do you save time when developing?

Paste Your Scripts Into the Comments

I, and I’m sure the other readers, would appreciate it if you’d paste in your custom Texter “mini-scripts” along with a short description of how they help you!

  • Subscribe to the NETTUTS RSS Feed for more daily web development tuts and articles.


Tags: Videos
Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • Pingback: 50 Incredible Tutorials from the Tuts+ Network | Free Tutorial 4 All

  • _equ

    In eclipse you can use for this purpose Afae, or Clips plugins:

    # Afae
    http://wiki.robrohan.com/index.html#Afae

    #Clips
    http://code.google.com/p/clipseclipseplugin/

    // for a python programmers there is also such template feature in the pydev plugin:
    http://pydev.sourceforge.net

  • Pingback: 50 Incredible Tutorials from the Tuts+ Network | Graphic Designer

  • http://www.ispeakwebstuff.co.uk Jack Franklin

    Hi Jeffrey,

    I’ve been using Texter for a while and have compiled a huge bundle of CSS shortcuts such as bb (border-bottom) bc (background-color:) and so on which I have been using, they have been extremely useful, so if anyone wants a huge bundle, let me know. (@Jack_Franklin)

    • http://tryingtofollow.com Ariah Fine

      I’m interested! email me if you don’t mind ariahfine at gmail

  • Pingback: 50 Incredible Tutorials from the Tuts+ Network - News ums Netz

  • Sathish

    Notepad ++ and quicktext plugin FTW!

  • David Morning

    If you have a script in texter, try starting it with:

    {BACKSPACE}{SHIFT}+{HOME}^c

    doing this means that you can type something before a trigger and use ^v to paste it into the trigger automatically. To use your example of linking stylesheets, you could use the script

    {BACKSPACE}{SHIFT}+{HOME}^c

    with the trigger “link”. This would let you type

    stylesheet link

    and because it copies all the text on the line before the trigger, replaces it then pastes it, get the result

    without having to go back into the generic code

    This can be expanded by using multiple lines as variables, but the scripts can get a bit ridiculous when you have too many of them

  • alberto marlboro

    Nice tip, now incorporated to my arsenal of weapons :)

  • Pingback: 50 Incredible Tutorials from the Tuts+ Network | rapid-DEV.net

  • http://www.jagdesignideas.com Joel Glovier

    Very nice!! Thanks.

  • Pingback: - The Ramblings of Ryan Lahay

  • http://letsgetcool.com ibrahim benzer

    jeff, google has heard you and implemented canned responses ;)

  • Cuijiudai

    The sofeware does not work well in e-texteditor ,that a pity….

  • http://www.bittrack.it/ Raspo

    This is just awesome!

  • Pingback: man0l: Това много ми хареса :) - edno23.com

  • Lagr Dagrsen

    Hey Great Tuts all around To this one O can only add that either in test, or Script more Texter will do some Xtra things with % in front of C it auto pastes the clip board contents where it finds $c, and rather than all them {UP} Just place a %| where ya would like to have it park the curor when it’s done

    Just like I am Thanx again

  • http://www.designfromwithin.com ThaClown

    I love this Texter, but have a problem.

    At home I work an a Vista x64 pc (so I use Notepad++ and Texter)
    At my job I use a MAC with TextMate (of course).
    Is there any way to sync the HTML, CSS and Javascript snippets between these programs?

    Or a Texter alternative that works on both MAC and PC would be nice….

  • Pingback: Crimson ruby » Blog Archive » კოდის წერის სიჩქარის მნიშვნელოვნად გაუმჯობესება

  • Pingback: Write your code faster!

  • http://www.generateaname.com flash

    Great tutorial.

    I’m forever forgetting what the tags are to enter code into words press.

    Now ‘addsource’ + TAB gives me

    {return}{return}

    {up}{home}

  • Pingback: How-to: Code with Super-human Speed | Geng Gao | the Blog | Design, Software, Gadgets blog

  • http://www.16software.com/breevy/ Patrick

    Hi all, I wrote a text expander for Windows a few months ago called Breevy (click my username next to this post for the website).

    In addition to some other cool stuff, it lets you position the cursor after the expansion (use the %(cursor) macro) and you can also insert the clipboard contents dynamically in the expanded text as well (use the %(clipboard) macro).

    So you can do something like:

    [body]%(cursor)[/body]

    and in the expansion, the cursor will automatically be placed between the tags.

    Breevy’s in active development, so if you have a feature suggestion, feel free to tell me about it.

  • Jeffrey Karbowski

    Created Texter bundles based on Sergey Chikuyonok’s Zen Coding plugins.
    http://code.google.com/p/zen-coding/

    Texter Bundle based on ZenCSS :
    http://texterbundles.googlecode.com/files/ZenCSS.texter

    and.

    Texter Bundle based on ZenHTML:
    http://texterbundles.googlecode.com/files/ZenHTML.texter

    • Agata

      So nice! Thank you, this idea is great!

      Heard too much about the TextExpander snippets (,HTML) and forgot about ZenCoding.

    • http://www.sandacreative.com Anoop D

      Thank you so much both of you …. for such a great tutorial and such a great bundle ..think i was a bit late getting here .. anyway thanks a lot once again

  • http://www.yourmom.com Matt

    Using dedicated soft-keys is an even better solution for most applications. I have the incredibly awesome Logitech G15 keyboard with 3 sets of 18 programmable keys. You can set keystrokes, scripts, or macros to each key. Some of the functions I use most are:

    *Show Desktop
    *Minimize/Maximize
    *Zoom in/Zoom out (especially useful for Photoshop, Illustrator, Browsers, etc..)
    *Move window to other monitor
    *Launch Browser
    *Username {TAB} Password {TAB} {ENTER} for secure logins that don’t allow your browser to remember passwords, like banks
    *stop();
    *gotoAndStop();
    *My email address

    You get the idea. Instead of remembering a keyword, typing it in and then pressing TAB, you just press one hot-key. This limits the risk of accidentally keying in a hotscript. The drawback is that you can only set a total of 54 macros. If you need more than that (which I haven’t yet), you can then start using Text Expander or whatever.

    I’m really surprised that this technology isn’t more popular. I use it constantly and will never go back to a regular keyboard. In fact, I broke my last G15 by spilling a bunch of crap in it and immediately bought an identical replacement.

    G15 Keyboard by Logitech:
    http://www.photoshopsupport.com/photoshop-blog/07/07/logitech-g15-keyboard.html

  • http://www.yourmom.com Matt

    Whoa, I just looked up the price of the G15 keyboard mentioned in the above post and it’s 250 bucks used on Amazon. An there’s only 2 left! I guess they stopped making the good model with 3×18 programmable keys for a crappier one that only has 6 hotkeys. Weak!

    I’ve come to rely on my hotkeys and when this keyboard eventually wears out, I’m gonna be in trouble.

  • Tim

    Texter looks promising, but I am have a trouble adding a curly bracket in the hotstring script. How to do that?

  • Vinicolas

    nice tut!!!!!!!!!! Thanks!!!!! Great!!!!!

  • Pingback: კოდის წერის სიჩქარის მნიშვნელოვნად გაუმჯობესება | Nap5teR

  • Pingback: კოდის წერის სიჩქარის მნიშვნელოვნად გაუმჯობესება

  • Pingback: 5 Killer Ways to Streamline your Coding Efficiency

  • Pingback: 5 Killer Ways to Streamline your Coding Efficiency | Free Web Design Tucson

  • Pingback: 5 Killer Ways to Streamline your Coding Efficiency | Prabaharan CS Blog

  • Marshall

    Jeffrey,
    I know this article is kinda old, and I noticed you stopped responding to comments some time ago.
    But I figured I would ask…

    Is there any way you could export your TextExpander snippets?

    Only reason I ask is because its kinda a pain to type along to your How To videos.
    I have to keep pausing the video just to catch up – Yes I’m a slow typer..

    Thank you in advance

    • http://www.jeffrey-way.com Jeffrey Way
      Author

      Hey Marhshall – It’s a big mix of programs (TextMate, TextExpander, Snippets, etc.) So, unfortunately, no.

  • Pingback: چگونه من ۲برابر سرعت شما کد می‌نویسم « >Hormoz.

  • Pingback: Texter, una poderosa herramienta para no perder tiempo tipeando | Tipoqueno Blog

  • http://www.vectshare.com/ Saroj

    try notepad++ Quicktext plugin. It’s similar to Tab Triggers in TextMate

  • http://www.jordansfreeshipping.com/ cheap retro jordans shoes

    try notepad++ Quicktext plugin. It’s similar to Tab Triggers in TextMate

  • Pingback: 6 Indispensible Apps for Web Workers | Amanda Hackwith

  • Akash

    Hi there! I have found live demonstration of “text expander” program in the series “CSS – Noob to Ninja” and it seems very helpful program, I am PC user and found “Texter” is a nice alternative to “text expander”.
    Jeffrey Way you Rocks!!! ;-)

  • laccy

    ive been using popchrome for chrome, its nice because synchs everything
    works only in chrome

    maybe i need to find some program or plugin for my text editor

    i have some dummy redirect email and sample passwords to extend, i know its not secure but usually its fast to register anywhere with 8 characters :)

    the problem comes when you cant remember
    but you can expand “remember” then undo :D

    or you can extend “STFU” to “please dont talk anymore” xD

  • Max

    I was experimenting with some “TextExpander for Windows” solutions lately and found an app called Autotext (http://jitbit.com/autotext), it’s cheaper that the others and support TextExpander bundles and macros commands.

    Perfect for my needs.

  • Vahid

    Always helpful , Thank you Jeff