11 Tools to Instantly Code Faster

11 Tools to Instantly Code Faster

Twice a month, we revisit or update some of our readers’ favorite posts and sessions from throughout the history of Nettuts+. This tutorial was first published last September.

Doesn’t the title say it all? There are a wide variety of tools and techniques which can drastically improve the speed at which we code. Particularly during time-sensitive settings, even a savings of a few seconds per iteration can add up substantially over the course of the month. I’ll show you eleven of my favorite tools in this article.


1. Zen Coding

Combine the power and specificity of CSS selectors with HTML mark-up, and you get Zen Coding. Certainly, I wasn’t the only one whose jaw dropped the first time he saw:

div#container>div#contents>ul#nav>li*4

…convert to:

<div id="container">
	<div id="contents">
		<ul id="nav">
			<li></li>
			<li></li>
			<li></li>
			<li></li>
		</ul>
	</div>
</div>

In this last year, the Zen Coding project has gained considerable attention, and has been expanded to support a wide variety of code editors, including Espresso, Vim, Netbeans, TextMate, and Komodo Edit.

“Zen Coding is an editor plugin for high-speed HTML, XML, XSL (or any other structured code format) coding and editing. The core of this plugin is a powerful abbreviation engine which allows you to expand expressions—similar to CSS selectors—into HTML code.”

Alternatives


2. Split Windows

For many, a simple tab-based coding experience is more than adequate; however, others prefer a more integrated approach. Unfortunately, the ability to split windows is not widely available across code editors. Luckily, though, a handful of them do support it at varying levels of flexibility (the king being Vim).

Vim

The excellent Vim editor offers an unprecedented level of window combinations. Use :sp and :vsp to create new windows from within normal mode.

Alternatives


3. Embrace Social Coding

In the last two years particularly, the idea of social coding has gained considerable popularity – and why wouldn’t it? If it’s fun to share photos on Flickr, the same will of course be true for coding. With site likes Envato’s recently purchased Snipplr, Github, or Forrst, not only can you manage your own snippets for future use, but you can also take advantage of multiple brains by receiving community feedback on your coding techniques and choices.

Snipplr

Envato recently purchased the popular Snipplr.com

Another social networking site? Yes, that is true; but, I must admit: it’s fun. Plus, it’s educational!


4. Code Management Tools

Online networks like Github, Snipplr, and Forrst are fantastic, however, they can be time consuming to access, when you need to reuse a specific piece of code (assuming it’s not already part of a bundle). The solution is to install one of the various code management applications available around the web.

Personally, as a Mac user, I prefer the not-free Snippets app.

Snippets App

With this tool, when I’m working on code, I can simply press, on the Mac, Command + F12 to insert my desired code snippet into my project. Even better, it integrates an “Export to Snipplr/Snipt/Pastie” feature that’s extremely useful.

Share with Snipplr

While many editors offer an integrated snippets utility, I’d recommend embracing a third party tool instead. This way, your snippets aren’t limited to a single editor.

Pro Tip

If you want to sync your snippets across all your computers, via Dropbox, you can create a symlink.

  • Step 1: Browse to ~/Library/Application Support/Snippets.
  • Step 2: Copy the entire folder to Dropbox.
  • Step 3: Create a symlink. In the Terminal, type: ln -s ~/Dropbox/Snippets ~/Library/Application Support/Snippets .
  • Step 4: Rinse and repeat for all of your computers.

What Sorts of Snippets Should I Save?

Everything you can think of! As a rule of thumb, if you tend to type some block of code more than once, save it. Let’s do an obvious one together; when producing a new website, how often do you type out the three lines or so to create rounded corners in the modern browsers?

#box {
 -moz-border-radius: 3px;
 -webkit-border-radius: 3px;
 border-radius: 3px;
}

This takes around ten seconds to type each time. What a waste! Instead, create a new snippet, and reduce your coding time by 90%.

Alternate Options


5. Choose a Proper Editor

The Holy Grail of efficient coding; your choice of code editor will have the largest effect on your coding speed. Unfortunately, there isn’t a definitive answer. Your decision will largely be dependent upon:

  • Which languages you code in
  • Your OS
  • The type of UI you prefer
  • Comfort with the command line (or lack of)

As an example, someone who predominantly creates HTML themes for a site like ThemeForest would be unwise to use a full IDE like Aptana. It’s simply unnecessary and too slow. However, the same is not true for a server-side developer.

Questions to Ask Before Deciding on an Editor

  • How important is speed? Should the editor open nearly instantly?
  • Do I require integrated debugging tools?
  • Does this editor offer some form of bundle functionality?
  • How easy to memorize are the keyboard shortcuts?
  • Are my favorite extensions and plugins (like Zen Coding) available for this code editor?
  • Do I require integrated Git logging?
  • Am I okay with a GUI interface?
  • Do I prefer speed over visuals…or Vim over Coda?

When I asked myself these questions, I determined that speed and performance were paramount. As such, I currently use Sublime 2 and Vim. The latter is significantly daunting at first, but provides an unprecedented level of flexibility and speed, due to the fact that even traversing your page requires a language, of sorts. However, for larger projects, which require debugging, I use Netbeans.


6. Use Bundles

Bundles: learn them…use them. Editors, like TextMate — and, subsequently E Text Editor — popularized bundles; however, they’re widely available from editor to editor.

What’s So Great About Them?

How many times have you found yourself typing the same generic piece of mark-up or code, whether that might be a new function, or the structure of a new jQuery plugin. How much time are you wasting each time you repeat this process? This is where bundles come into play.

For example, by downloading the TextMate CodeIgniter bundle, we can take advantage of a wide array of methods and snippets. Remember – less typing is always a good thing!

CodeIgniter Bundle

With this bundle installed, we only need to type the designated shortcut, and then press tab (in most editors). This will then expand the shortcut into the requested code. What separates a bundle from a snippet is that you can specify multiple tab stops to further expedite your coding speed.

Vim Users: if you miss/envy the TextMate bundle feature, check out the SnipMate plugin.


7. Use a CSS Preprocessor

Tools like LESS.js and Sass can drastically increase your coding speed. In terms of which one to choose: they’re both excellent. These days, I tend to prefer Sass, since the Compass framework is built on top of it, and provides an unparalleled number of convenience functions. It also seems to be what the cool kids use. :)

How Does it Work?

These tools allow for all of the features that you wish CSS had — such as variables and functions.

/*
Variables!
*/
@primary_color: green;

/*
Mix-ins are like functions for commonly used operations,
such as apply borders. We create variables by prepending
the @ symbol.
*/
.rounded(@radius: 5px) {
	-moz-border-radius: @radius;
	-webkit-border-radius: @radius;
	border-radius: @radius;
}

#container {
/* References the variable we created above. */
	background: @primary_color;

/* Calls the .rounded mix-in (function) that we created, and overrides the default value. */
	.rounded(20px); 

/* Nested selectors inherit their parent's selector as well. This allows for shorter code. */
	a {
		color: red;
	}
}

Pro Tip: To make your browser update every time you save a file (very handy feature), use the watch method. Place the following at the bottom of your project. Of course, this assume that you’ve already setup LESS.js.

less.env = 'development';
less.watch();

LESS Compiler

Many might argue that it’s unsafe to use a JavaScript-based solution. But that’s okay; there are a handful of compilers available around the web. The best solution I was able to find is called LESS.app.

LESS APP

After you download it (free), you simply drag your project folder into the app, which instructs it to watch all .LESS files. At this point, you can continue working on your project, per usual. Every time you save, the compiler will run, which generates/updates an automatically created style.css file. When you’re finished developing your app, you only need to change your stylesheet references from style.less to style.css, accordingly. Easy! Now there’s no reason not to take advantage of LESS — unless you’re using a different solution, like Sass.

Take our mini-series to learn exactly how to work with Sass.

Generates CSS FIle

8. Prototype Early with Firebug

You know the drill: write a bit of JavaScript, switch and refresh your browser, receive an error, return to the editor…and rinse and repeat. Though we all do it, sometimes, there are far more efficient alternatives, such as protoyping early with tools like Firebug. By working directly in the browser, you cut out the middle man, so to speak.

The uber-talented Dave Ward recommended this tip, and has even created a screencast demonstrating this method.


9. Use Prefixr

Prefixr

Tools like Compass, or even a TextMate bundle are tremendously helpful – I use them often, actually. But, for many projects, they aren’t available. As a result, we’re left in the position of having to copy and paste over, and over…and over.

I built Prefixr to do all this tedious work for me. Simply paste in your stylesheet, press Prefixize (or hit Control + Enter), and Prefixr will filter through the applicable CSS3 properties and dynamically update them.

Can’t remember if Opera provides a prefixed version of, say, the transition property (o-transition)? Don’t worry about it; that’s already coded into Prefixr!

With Prefixr, you only code your stylesheets using the official W3C-recommended markup. When ready for deployment, run the stylesheet through Prefixr, and be done with it!

Learn more about Prefixr.


10. Find an Editor that Offers Multi-Select

I’ll first warn you that very few code editors offer a multi-select feature. The editor that I currently use, Sublime 2, does though. Even better, it’s available for both Windows and Mac users.

So what exactly is multi-selection? Well, editors like TextMate have long offered vertical selection, which is quite neat. But, with multi-selection, you can have multiple cursors on the page. This can drastically reduce the need for using regular expressions, and advanced search and replace queries. Perhaps a quick visual demonstration is in order…


11. Don’t Reinvent the Wheel

When first getting started in this field, I always took issue with comments like “Don’t reinvent the wheel.” It’s not about reinvention; it’s about understanding how the wheel functions. However, once you know the inner workings of the wheel, this argument certainly is true: Don’t Repeat Yourself.

Coding each new project from scratch is incredibly time consuming.

If you want to complete new projects as quickly as possible (and who doesn’t), save yourself some time, and take advantage of the various levels of abstractions that are available around the web. A handful of my favorites include:

  • HTML5 Boilerplate – Whether you choose to use this template in its entirety, or in bits and pieces, it doesn’t matter. Just use it! And while you’re at it, split the sections of code into snippets for reuse! Watch the official guide to Boilerplate on Nettuts+
  • CodeIgniter (PHP Framework) – For higher level PHP applications, the CodeIgniter framework is a fantastic choice. Even better, the community support is second to none. If you happen to be a visual learner, our CodeIgniter from Scratch series is, also, second to none. :)
  • 960 (CSS Framework) – If you require grid-like structures, both the 960 and Blueprint CSS frameworks are fantastic choices. They easily turn hours of work into a two minute process; and, if you’re worried about file bloat, you needn’t. That’s a ridiculous argument. Let us teach you how to use 960!
  • jQuery (JavaScript Library) – Does this one really require explanation at this point? Save yourself the headaches, and use it (that is, unless you’ve developed your own awesome library).

Conclusion

I’ll show you mine if you show me yours. Which tools and resources do you use to code faster?

Tags: tips
Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://hongphuc.info Hongphuc Group

    Nice tip! Thanks 4 share :)

  • http://www.edsolution.si/ Izdelava strani

    Really good article. Thru it I’ve discover the Zen Coding and I can tell that things are now much faster when you are slicing web design.

    Keep up a good work!

  • Oscar

    Great Tutorial Thanks

  • Jermaine

    Question: is it possible to have Split Windows in Aptana Studio 3 ?

  • Bob

    Is there any good Mac text editors that support Zen Coding? I can’t seem to find one :(

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

      Most all of them. :)

    • http://www.etaproducto.com/ Peter Demaria

      Coda! I love Coda, and it works great with Zen coding… I am forced to be a PC at work and pine for Coda on the regular :(

  • Julius

    Nice tip Jeff

  • http://www.non-official.com Zeuf

    Under Windows, I use Notepad++ for years… I am still so grateful to it. It can do almost everything : multiple editing, compare, incredible search tools (find words, like ‘id=”navig”‘ for example, among files), …. Of course free

  • Thiago A.

    Jeffrey, what is the difference between Snippets and TextExpander? I already own TextExpander, so I don’t know wether Snippets is worth.

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

      Snippets is specifically made for managing snippets. So it offers syntax highlighting, grouping, etc.

    • http://andyeveland.com Andy Eveland

      I use Text Expander to manage all my WP Shortcodes. You can get pretty creative too if you use clipboard contents inside the snipet ie. I copy a url from my browser then want to insert the link in a post… I type “aelink”

      <pre name="code" class="html"><a href="http://net.tutsplus.com/articles/general/9-ways-to-instantly-code-faster/?replytocom=376108#respond">CODE FASTER</a>

      This is a pretty basic example but when I have a more complex layout this speeds up the process and eliminates errors. Here is more on how I use it: http://bit.ly/saqxF7

  • http://www.lickmydesign.co.uk Adam

    You can add JetBrains PHPStorm/WebStorm to the list of alternative code editors offering split screen functionality.

  • http://hyvaa.tistory.com hyvaa

    Great Collection. Thx :)

  • http://blog.lastrose.com LastRose

    One tool I recently discovered is http://www.webputty.net/
    It allows for rapid building (see your css affecting the page as you work, and deploy the results when done) and it also supports SCSS and Compass

    • http://www.instamedia.com arun

      Thanks for sharing, i love it.

  • Igor

    Greate tutorial, but you could write apps for mobile too, like ipads?

  • http://www.nytogroup.com/ Dan

    Great article! I love Snipplr :)

  • http://nvmind.com Ignacio

    I cannot recommend Sublime Text 2 enough. The split window functionality is very useful, among other features like the side zoomed-out window which lets you jump anywhere in the code.

  • http://www.pdvictor.com Peter Drinnan

    I was aware of most of these tools already but Prefixr is new to me and seems amazing. Thanks Jeffrey.

  • Daniel

    Sublime 2 is also available for Linux by the way.

  • http://www.trupalwebsolutions.com Patrick

    Nice suggestions! I am always looking for new ways to streamline and speed-up my development processes. Thanks!!

  • http://benmartinstudios.com.au Ben

    I don’t know if this has been posted, but #9 reminded me of this. This is something that has saved me hours…

    When using the console, there is a little triangle icon to the far right that brings up the Command Editor (a multiline console input). I’ve been able to develop more complex code in the browser using this technique which has saved me so much time running back and forth. Even with something as simple as a click event, the code in the browser would look like:

    var elem = $(‘.elements’);
    elem.unbind(‘click’); //so that the old code doesn’t get executed
    elem.click(function(ev){
    // execute heaps of code here
    });

    I’ll run the code, and make adjustments depending on whether it does what I want or not, then rinse and repeat until I’m satisfied. Once it works the way I want, I just make it ready to go into the js file by removing lines like:
    elem.unbind(‘click’);

    This has been a really, really, really useful technique for me (honestly, I cannot express how much my efficiency has increased since I discovered this). The amount of time this saves goes up exponentially if you have to work on a live site that takes a few seconds to reload the page.

  • Taha M. Asadullah

    I use PSPad. Here I have option of dropping images in the editor, It saves a lot of time. It picks up the src and stuff automatically.

  • http://www.methack.it/devblog mattia

    really a good read! but… for linux users, is there any useful solution about Code Management Tools?
    i would something like Snippet App or similar, to easy search and include snippets of code into my projects.

  • http://emka.web.id Luthfi Emka

    I’m using Geany IDE as my editor, it quite fast and have several plugins. I like its Code Completion and snippets completion.

    • Pothi

      I moved to Geany a while back, and never turned back. I was a long time fan of VIM. But had to move away since I use a different keyboard layout (Colemak) that doesn’t play nice with VIM.

  • Skydda

    Anyone looking for less serverside for windows?

    Here’s something helpful: http://www.vertstudios.com/blog/less-app-windows-sorta/

  • http://www.creativesparkmedia.co.uk Gary knight

    Love the zen coding but is there a mac text editor that will do this. I have looked all over the net but can’t find one.

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

      Just about all of them offer it, via a plugin.

  • Paul

    Could you expand on your “Pro Tip” for syncing the Snippets software using Dropbox. I’m not getting it. I copied the Snippets folder into Dropbox, but when I paste in the Terminal command and run it I get “ln: Support/Snippets: No such file or directory”.

    I found a little App that creates symlinks by putting a command in the Services menu when right clicking on a file or folder, but I can’t follow from your instructions how to set this up. If I have Dropbox>Snippets, do I put a symlink linking back to the original Snippet folder in the Library, inside the Dropbox>Snippets folder?

    If I then “rinse and repeat”, I can’t have another “Snippets” symbolic link inside the Dropbox>Snippets folder since one already exists.

    I would really like to be able to do this.

  • http://ignitewebsites.com IgniteWebsites

    Jeffrey thanks for the list of coding tools. Was not aware of prefix. I will check it out.

  • http://www.carlosja.com CarlosJa

    NotePad++ has some great plugsin that helps developers code faster.. I’m into using apps that do automated stuff they tend to get things a little messed up. but good article.

  • khan

    nice

  • Burak Erdem

    Working with LESS is so much fun. I was looking for a compiler. I didn’t know the LESS Compiler, it works great. Thanks Jeffrey, great post.

  • http://www.youtube.com/watch?v=IsbQqOTP-t Elder Care in Coachella

    [...]The information mentioned in the article are some of the best available [...]…

  • cp

    If you call writing markup coding, then yes and thx:)

  • cp

    If you call writing markup coding, then yes and thx:)

  • http://www.rsatechnologies.in rakesh kumar

    I have not think about in this extend about the editors, Till now the most favorite editor off mine was notpad++ and believe me i was quite happy with that. Your article has change the total perspective. Thank you very much.

  • http://zinmin.phpfogapp.com thanyawzinmin

    Don’t you use NotePad++!

  • amit mojumder

    In the web Jeffrey Way is myy most favorite teacher…..with a lot of love and respect…thanks for sharing those incredible resources with us….

  • Abilon Dias

    For editor, Intype Editor on Windows, there’s a good time I’m using it – http://inotai.com/intype/
    Sidebar file manager(project manager too), bundles, don’t know if It supports zen-coding yet.

  • http://www.iwebprovider.com Innovative Web Provider

    All of these tips are very awesome. Just like the author, you’re great! I’ve been reading some articles on this site and encountered some of your tutorials. Thank you so much.

  • http://www.kupuj-taniej.com bilety do polski

    [...]the time to read or take a look at the content or web pages we have linked to below the[...]

  • http://dsad dsa

    dsadasd

  • Andres

    Nice contribution.
    compact, straight.

    Even ninjas forget the wheel rule!

  • http://www.facebookfever.com/ Govind Choudhary@FacebookFever

    Amazing tools…learn few thing from this post :)

  • Mats Svensson

    Is there something like Snippets app. but for windows?

    Something that JUST works straight out of the box,
    without turning into some big song-and-dance research project?

    I have yet to find ANY tool for making programming easier, that doesn’t end up causing more work than it saves =(

  • Sergey

    What does this sentence mean: “..With site likes Envato’s recently purchased Snipplr, Github, or Forrst..” !?
    Did Envato purchase these websites or is that something I misunderstood?

  • ruslyrossi

    Hi,

    don’t forget cssUpdater (http://www.cssupdater.com/) when we change something in firebug(css) this plugin will save into css file…it’s work great!!

  • http://tipsrumahtangga.info/ tips rumah tangga

    nice tips i need to learn it. thanx for share this great post.

  • Ignacio aular

    Hi,

    Nice tutorial… Thanks for everyone…

    Please, can someone to tell me where can I find out xhtml templates 100% editables…

    Thank you very much in advance…

    Please excuse me.. .My English isn’t very well… I’m from Venezuela.!

  • Jonathan Beech

    Hello Jeffery, thank you so much for all helpful advice, I’m just getting acquainted with some of the tools you mention such as Sublime Text, previously I used Textmate and other applications like Expresso for mostly html and css work. One piece of software I used lots is CSSEdit, I really like the ability to be able jump straight from an element say a header on the visual browser window to the actual css code using the inspector panel. Do you use this software much? I suppose I’m more of a designer so I like this feature of CSS Edit

  • http://www.fmrwebdesign.com Foz

    Nice Post…I have been working on redesign for a website and I’m using CSS3 rounded corners and and box shadow a lot, every time I go back to my older styles to copy the code. Snippet sounds like a good idea!

  • Cam

    How could you leave out twitter bootstrap?

    • Scott

      Probably because he wrote this before Twitter Bootstrap came out…

  • http://www.itarticle.net/ ITarticle

    Nice tutorial… Thinking to update my blog http://www.itarticle.net

  • http://www.lastrose.com/ Last Rose Studios Inc.

    Live Reload is also a must these days