Rejuvenate

Optimizing workflow with Sublime Text

Rejuvenate's avatar

Sunday 25th Sep 2016

By Rejuvenate

Development

If you're thinking about getting started with Sublime Text, here’s a few of my favourite workflow tips to help you along.

 

Those new to coding will know that the options for today’s web developer are endless. New text editors such as Sublime Text, Atom, PHP Storm and Brackets are always being introduced so it can be confusing where to start.

If I were starting out from the beginning again I’d certainly recommend Sublime Text to my younger self. It’s not just for newbies though, I’d also recommend it to some of the elder developers who have lived through the Dreamweaver CS3 era.

Why Sublime Text you may ask. Well, one reason is that it’s as easy as reading a spoiler for GOT (Game of Thrones for those living under a rock). Another reason is that its simplicity takes away all of the distractions and sluggishness of other text editors, although mastering it will take a bit more patience.

Multi Cursor

Multiple cursors are a god send when having to edit more than one line with the same text and it saves having to manually update each line. There a few ways to start using multiple cursors, if you have an item of text selected you can use Ctrl+D (as gif below). This will match anything one by one with the same string of text, allowing you to bulk change the string. Alt+F3 can also be used to select all matches in one go.

MULTI CURSOR

Alternatively multiple lines can be selected by using Ctrl+Alt+(Up/Down) - this will add a cursor to the point in the line above or below. Holding Ctrl down will allow you to manually place cursors and Ctrl+Shift+L will add a cursor to the end of each line in a selection.

More information on multi-cursors.

Keyboard Commands

One of the biggest benefits of sublime is the amount you can do with just the keyboard alone. There are way too many shortcuts to list but here's a quick example.

Keyboard Commands

So in order, the first command was Ctrl+Shift+K to remove Mike #sorrymike*. I next duplicatated John with Ctrl+Shift+D, using the multi cursor I tabbed all the names correctly, finally ordering my friends by hitting F9.

* We’re not actually sorry, Mike asked for it really for using the last of the milk.

Keyboard Shortcut Cheat Sheet

Snippets

Extensibility is another great feature of Sublime Text; it comes pre-packed with a multitude of snippets you can use to save writing out generic blocks of code you regularly use. You're also able to create your own snippets, below is a quick example of creating a snippet for 'clog', it automatically changes when typed to become console.log and focuses the function parameter.

Snippets

More information on snippets

Final Word

The points above are only scratching the surface of how Sublime Text can help speed up workflow. Plugins such as Emmet, Task runners and the ability to fully customize Sublime to your prefrences make daily tasks that little bit quicker and easier.