Useful Sublime Text 2 Shortcuts for Beginners

I believe that there is inherently goodness in a small degree of laziness. It forces you to be efficient and creative in order to maximize the output of your work. To that end, I’ve compiled a few of the shortcuts I use every day as a new Rubyist.

Note that I’ll be using OS X notation.

1) CMD+D for multi-select - This command will allow you to highlight a word and then find all repeats of the word in your file. Maybe you changed a variable in a class from “students” to “student” and want to mass replace them? CMD+D repeatedly to get all the instances of it that you’d like to replace!

2) CMD+T to open a file - Have you ever been in a scenario where you needed to quickly check another file in your current folder? CMD+T lets you immediately type the name of the file (with an autocomplete dropdown box) to find it! AWESOME!

3) CMD+2 for split-pane - As I begin an attempt to really grok TDD, I started to write failing tests. The problem was that I often had trouble making them pass. What the hell? Best way I could really figure out what was going on was to throw up a second window and look at both my test AND my code.

4) CMD+click for multiple cursors - Sometimes you want to start deleting in multiple places, such as turning instance variables into local variables by removing the @ symbol. Maybe you just need to fix some repeated typos. Doesn’t matter, click around to place multiple cursors and add/remove as needed.

5) CMD+CTRL+A to align equal signs - This is particularly helpful when you’re assigning rows and rows of variables. Make your code sexier by lining up the equal signs!

If there are any other shortcuts you use often, drop a comment and let me know!