December 14, 2006
Two Really Handy Textmate Shortcuts
I’ve started to use two shortcuts of Textmate quite often over the past few weeks and I have decided that collectively they might be the best two shortcuts I have come across in any editor I have used to date.
1) Star Me
“Productivity depends on being able to juggle a lot of little details in short term memory all at once. Any kind of interruption can cause these details to come crashing down. When you resume work, you can’t remember any of the details (like local variable names you were using, or where you were up to in implementing that search algorithm) and you have to keep looking these things up, which slows you down a lot until you get back up to speed.”
—By Joel Spolsky in Where do these people get their (unoriginal) ideas
How often do you switch between files or even jump to the top, bottom or middle of a single file? Often is the correct answer, at least I know I do. Like Joel mentioned above, we programmers have a lot of things we are balancing in our short term memory so anything that can help us remember where we were at is extremely beneficial.
This is where the shortcut command-F2 comes in handy. Any line that you are on and want to bookmark, just hit command-F2 and it will star (bookmark) the line. You can then jump from star to star by pressing F2. Anytime I go searching for another piece of code and I want to make sure I don’t forget where I’m currently at, I star the line. This shortcut keeps one more thing out of my short term memory and helps me to focus on what the problem at hand was, not the line number.
2) Go To File
If you have never used command-t, then open up a Rails project in Textmate. Hit command-t and start typing the name of the file you would like to open. You should see a box along the lines of the one pictured below.
This is beyond handy. Especially, when you want to check out something in the Rails source. Let’s say you want to see all the core extensions to the hash object. If you have a project open with Rails froze in the vendor folder, you can hit command-t, type ‘hash’ and hit enter. Boom, the hash.rb file is now open. From there you can see all the files that extend hash. Pick one, hit command-t again, type the name of the one you picked and hit enter. So handy.
So those are my favorite shortcuts, now it is your turn. Name one or two Textmate shortcuts you would really miss if they went away tomorrow in the comments below.