Sublime Text 3 Cheat Sheet

One of my favourite pieces of software is Sublime Text 3. It is my text editor of choice, and is well worth the cost given the number of hours I use it each and every day.

I utilise Sublime in a rather simplistic way. It looks fantastic, and its syntax highlighting functionality allows me to follow my code with ease. It also offers a number of customisable shortcuts and keyboard commands to allow you to navigate through my code in an efficient manner. These include:

  • CMD + R which allows you to navigate to a specific function.

  • CMD + P which allows you to navigate to a specific file.

Recently I have been working extensively with JSX. I noticed that my .jsx files did not have any syntax highlighting.

Fortunately Sublime offers 'Package Control' which allows you to easily and quickly install plugins developed by third party developers.

I quickly found the Babel package and installed it within seconds.

Whilst I now had syntax highlighting for .jsx the colors were a little garish. Installing new color schemes is just as easy as installing new packages. Another developer has created a package called ColorSublime which allows you to choose, preview, and install new color schemes instantly.

Other useful tricks

Whilst I was at it I figured I'd investigate (and collate) any other useful tricks I could find for Sublime so as to make my workflow more efficient.

These are listed below.

  • Option + ⌘ + 2 displays two panes side by side.

  • Shift + Option + ⌘ + 2 displays two panes one above the other.

  • ⌘ + Control + Shift + F goes into 'Distraction Free Mode'. This essentially makes Sublime fill the screen, and removes any unnecessary panes etc.

  • Cmd + / comments the selected code.

  • Cmd + Shift + J selects all adjacent lines with the same level of indentation.

  • Cmd + Shift + V pastes the copied code at the level of indentation where your cursor is.

  • Cmd + Ctrl + G selects all instances of whatever you have selected.

  • If you select a CSS properties list and hit F5 it will sort them alphabetically.

  • Ctrl + M takes you to the opening/closing tag counterpart of that positioned where the cursor is.

My packages

To finish off this brief 'cheat sheet' I figured I'd also outline the 'Packages' that I have installed and utilise.

  • Babel (as mentioned above).

  • ColorSublime (as mentioned above).

  • PHPUnit. Yes, there is a plugin for running your unit tests directly from Sublime !

  • Sublime PHP Coverage. Yes, there is a plugin for showing your test coverage inline within Sublime !

  • Sidebar enhancements. Provides additional useful functionality when you right click within the sidebar. For example I regularly use 'Open in Finder'.

  • Emmet. This makes writing your code quicker by proxy of a number of shortcuts (which you have to learn). I have only recently installed this, and need to investigate further.

Conclusion

I have used Sublime Text daily for over three years. It is awesome.

I thought that before I realised the full extent of what it can do. That says a lot about how good it is.

Hopefully this basic overview of useful functionality will make you more efficient when writing code in Sublime (which at this point you should have definitely bought.. :P)

If you have any questions, or know of any other 'must know' shortcuts, please do let me know.


Thomas Clowes

Thomas Clowes

I am a 28 year old software engineer from the United Kingdom. During the day I build multi platform applications. In my spare time I eat food and run marathons. Sometimes I write angry tweets.