Sublime Text 2: Tips, Tricks, and More

Here are a few of my favorite Sublime Text 2 features will blow your mind if you’re new to the wonderful world of this powerful editor. If you have seen these before, consider this a handy reference. Sublime Text 2 is my favorite editor, by far. If you haven’t already, install it and take it for a test drive.

Basics

The following list of commands and descriptions cover the basic tools I use on a daily basis to make coding a breeze.

  • TAB: shifts selected line(s) to the right by the current tab size
  • SHIFT+TAB: shifts selected line(s) to the left by the current tab size (if possible)
  • CTRL+left or right arrow key (OPT+left or right arrow key on OS X): moves the cursor to the last or next word
  • CTRL+/ (CMD+/ on OS X): toggles commenting on the current line (or selected line(s))
  • CTRL+R (CMD+R on OS X): pulls up a list of symbols in the current file (symbols could be functions in some python
  • CTRL+P (CMD+P on OS X): pulls up a list of the currently open files

Multiple Selection

How to Do It

CTRL+D (CMD+D on OS X)

What It Does

If you have selected a word or phrase, this shortcut adds to the current selection the next occurrence of the selected text in the current file. That is, when starting with a segment of selected text, after pressing CTRL+D (CMD+D on OS X) you will now have two cursors and two selections of the same sequence of characters in your file. You can keep pressing the shortcut to add to your current selection. This is useful when you need to change a variable name throughout a section of your document. Simply select the first occurrence, enter the shortcut until you have selected each phrase you want to change, then start typing the replacement text. (NOTE: If you have not selected anything, this shortcut selects the current word.)

Command Palette

How to Do It

CTRL+SHIFT+P (CMD+SHIFT+P on OS X)

What It Does

This shortcut opens the command palette which quickly allows you to access anything in the Sublime Text 2 menu. I use it to look up available snippets in the current syntax (just start typing “snippet“). In fact, the fuzzy search algorithm used to match your text in the command palette means you could type “snppt“, or any other abbreviation to filter the available commands.

See Also

Creating Snippets in Sublime Text 2 for LaTeX Making your first PDF with LaTeX and Sublime Text 2

Leave a Reply