If you're a programmer, you're either more comfortable using a text editor or a full-blown IDE, and your choice will likely depend on the programming languages you use. But if you go the text editor route, Sublime Text is the king.

Note that Sublime Text isn't just for programmers, though programmers will get the most bang out of it. It can also be useful for simple tasks like keeping to-do lists (using the PlainTasks plugin), editing config files, or writing batch scripts.

Here are a handful of tips that elevate Sublime Text above its competitors, making it more productive and easier to use.

Note: I'll be focusing on Sublime Text 3, but there may be some overlap with Sublime Text 2.

1. Quick-Go to File, Line, or Symbol

Sublime Text makes it trivially easy to navigate between hundreds or even thousands of files without ever touching your mouse. There are three important "Quick-Go" (I made that up) shortcuts to know.

  • Ctrl + P (Windows, Linux)
  • Cmd + P (Mac)

You'll see a popup where you can start typing anything. Sublime Text takes your input and shows a real-time fuzzy match of all files that exist in any loaded project folder.

sublime-text-quick-go-anywhere

You can also go directly to a certain line:

  • Ctrl + G (Windows, Linux)
  • Cmd + G (Mac)

And you can go directly to a certain symbol:

  • Ctrl + R (Windows, Linux)
  • Cmd + R (Mac)

2. Quick-Go to Matching Bracket

Another useful "Quick-Go" shortcut for programmers is the ability to teleport directly to a matching brace. This is particularly useful in brace-heavy languages like Java, C#, JavaScript, etc. but it can also prove useful when you're lost in nested parentheses.

sublime-text-matching-bracket

All you have to do is:

  • Ctrl + M (Windows, Linux)
  • Cmd + M (Mac)

And the beauty of this is that it can teleport forwards AND backwards. Very useful for teleporting from the bottom of a function/method to the very beginning of it.

3. Search Within Entire Project

We all know how to use the Find function to look for text within the current document or source file, but Sublime Text takes it one step further with the ability to search an entire project folder -- similar to what can be done with

        grep
    

on a command line.

  • Ctrl + Shift + F (Windows, Linux)
  • Cmd + Shift + F (Mac)

Not only is the project search fast and efficient, but it can also be modified by regular expressions, case sensitivity, and you can even filter out certain folders from the search pool.

4. Multi-Text Selection

Have you ever had a piece of code (or any other set of text) where you needed to rename a bunch of the same terms? For example, a variable that's used dozens of times throughout a script. To rename it, you could use Find & Replace All.

sublime-text-multiple-selection

Or you could use the far more flexible and useful Multi-Text Selection feature in Sublime Text. All you have to do is place your cursor on the term you want to edit and then hit:

  • Alt + F3 (Windows, Linux)
  • Ctrl + Cmd + G (Mac)

This will select ALL instances of that word in the entire document -- and since Sublime Text supports multiple text carets, all you have to do is type and ALL instances will be edited simultaneously.

Or if you only want to select a few instances of the word, you can use:

  • Ctrl + D (Windows, Linux)
  • Cmd + D (Mac)

Every time you hit the shortcut, the next instance will be added to the multi-text selection.

5. Duplicate Current Line

Line duplication is a mundane feature in most modern text editors, but it's useful to know the shortcut for it in Sublime Text.

  • Ctrl + Shift + D (Windows, Linux)
  • Cmd + Shift + D (Mac)

This will copy the entire current line (even if you haven't highlighted anything) and duplicate it, placing it into the line that's directly below -- and if a line already exists below, Sublime Text just inserts it and pushes the other lines down.

Very useful to use in conjunction with the multi-text selection feature mentioned above, especially when making a bunch of hyperlinks in HTML, for example.

6. Shift Line Up and Down

Have you ever written a line (or lines) of code that needed to be moved elsewhere? One way to get it where it needs to go is to use copy-and-paste, which works well enough for large chunks of text. You can also use drag-and-drop if you like.

But there's an easier way. Just select the text you want to move and hit this shortcut:

  • Ctrl + Shift + Up or Down (Windows, Linux)
  • Ctrl + Cmd + Up or Down (Mac)

This will shift the entire text selection up or down by one line. It's by far the easiest way to rearrange lines of code, and if you don't have anything highlighted, it will automatically shift the current line where the cursor is.

7. Instant Comment

Imagine you have a big chunk of code that needs to be commented out, whether for debugging purposes or whatever else -- but maybe you don't want to use span-based comment tags (such as

        /* */
    

in C++).

I can't tell you how many times I've mindlessly added // to the beginnings of lines by hand to comment out entire sections of code. But with Sublime Text, it can all be done in one fell swoop:

  • Ctrl + / (Windows, Linux)
  • Cmd + / (Mac)

Just highlight the entire chunk, press the shortcut, and each line will be individually commented out. The same shortcut will uncomment lines that are commented out.

This is really easy to remember because you were going to hit the

        /
    

key to comment out the line anyway, right? But the good news is that this also works for languages like HTML where comments are made using

        <!--
    

and

        -->
    

, for example.

8. Select or Delete Current Line

For a long time, I used to use a double keystroke combo to highlight the current line of code: End, Shift + Home. But when I switched to a compact keyboard that lacked End and Home keys, I found myself at a loss.

Fortunately, Sublime Text has a quicker way to do it:

  • Ctrl + L (Windows, Linux)
  • Cmd + L (Mac)

Sublime Text also has a one-stroke method for deleting the entire current line, even if nothing is highlighted:

  • Ctrl + Shift + K (Windows, Linux, Mac)

9. Use Multiple Panes

If you're using a large widescreen resolution (e.g. 1080p) then you probably don't need the entire width of your screen for one single source file or document. So why not split Sublime Text into two side-by-side panes for more productivity?

Navigate to View > Layout > Columns: 2 (or use the Alt + Shift + 2 shortcut) and voila!

sublime-text-multiple-panes

Not only can Sublime Text have more than two columns, but it can also create vertical panes for those of you using a vertical monitor.

10. Use the Command Palette

By now, you might be feeling overwhelmed by all of these different keyboard shortcuts and menu options. Plus, switching to the mouse just to select menu options is a huge waste of time and a big productivity killer.

So if you walk away from this article having learned only one thing, let it be this: learn to use Sublime Text's Command Palette!

sublime-text-command-palette

To bring up the Command Palette:

  • Ctrl + Shift + P (Windows, Linux)
  • Cmd + Shift + P (Mac)

And with the Command Palette, you can execute almost any command that's available to Sublime Text just by typing it out: changing view options, opening bookmarks, switching files, etc. And if you have plugins, they can install new palette commands as well.

11. Save on Lost Window Focus

If you're like me, you press Ctrl + S (or Cmd + S on Mac) a billion times per minute out of the fear that you'll lose your precious works in progress. Yes, it's good to wear out the save shortcut, and it's also good to keep regular data backups, but here's a failsafe for you.

In short, every time you switch away from Sublime Text to another window, Sublime Text can instantly save all unsaved files. Enable it by opening your User Preferences and adding:

"save_on_focus_lost": true

Or you can enable this feature for certain languages only by going to the /Packages/User/ directory, opening the .sublime-settings file for the language you want, and adding that same setting there.

Why Do You Use Sublime Text?

Sublime Text has been my text editor of choice for years, and I don't see that changing any time soon.

But I want to know: why do YOU use Sublime Text? Know of any other cool tips or tricks? If you don't use Sublime Text, why not and what do you use instead? Let us know in a comment below!

Of course, Sublime Text isn't the only viable text editor out there, but there are many reasons why it's one of the most popular, the biggest ones being its fast performance and its massively useful productivity features, including an extensive set of keyboard shortcuts, which we have compiled into a list for you. Use our Sublime Text keyboard shortcuts cheat sheet to speed up your workflow further.