Monday, June 09, 2008

TextMate Keyboard Shortcuts

Those who have been reading this blog know that I like IntelliJ and blogged about it a number of times in the past. But let's admit it: IntelliJ is a big guy. It is heavy. Starting IntelliJ takes minutes. Even alt-tabbing to IntelliJ after not using it for a while can take minutes. And all this on a fairly top-of-the-line laptop. This led me to experiment with other editors, in particular TextMate.

TextMate compares more to Emacs or SlickEdit. So it won't replace IntelliJ for everything, but I have been using it for a week and it worked quite well for simpler tasks. For those of you who would also be starting to use TextMate, I put below a list of the keyboard shortcuts I use the most. I hope you will find it useful, and if you have other suggestions please post them in the comments.

Subversion: ^⇧ A
Diff: ^⇧⌘ D
AckMate (powerful "search in project" using ACK): ⇧⌘ A
Git2: ^⇧ G
MissingDrawer (replaces the standard Project Drawer)
JavaScript Tools: ^⇧ V to run JavaScript Lint
Line/block operations
Select current word: ^W
Select current line: ⇧⌘L
Duplicate: ^⇧ D
Delete: ^⇧ K
Move: ^⌘ up/down
Re-indent: ⌥⌘ [
Indent left: ⌘ [
Indent right: ⌘ ]
Find in project: ⇧⌘ F (but ack is better)
Copy to find buffer: ⌘ E
Go to file: ⌘ T
Go to symbol: ⇧⌘ T
Incremental search: ^s
Paste previous: ⇧⌘ V
Paste stack: ^⌥⌘ V
Reveal and Project Drawer
In project: ^⌘ R
In Finder: ^⇧⌘ R
Move focus from editor to project drawer: ^⇥
Move focus from project drawer to editor: ⇧^⇥
Create bookmark: ⌘ F2
Go to next bookmark: F2
Type tag pair: <⇥ (then type tag name, then ⇥ again)
Insert closing tag: ⌥⌘ .
Completion: Esc
Show all the shortcuts that apply in the current context: ⌃⌘T
Disable/enable check spelling as you type: ⌘⌥ ;
For the sake of how it looks: the green moleskin icon3

1 To install a bundle, copy the MyBundle.tmbundle directory in your ~/Library/Application Support/TextMate/Bundles.
2 If you like me, your Git binaries are in /usr/local/git/bin, after installing the Git bundle, set TM_GIT to /usr/local/bin/git (in the TextMate preferences, Advanced, Shell Variables).
3 From the Green Moleskin package, I only use their gorgeous icon. Download the package, unzip it and you'll find the icon in Green_Moleskine/Etext Icon/moleskine_textmate.ico. First cp "Green_Moleskine/Etext Icon/moleskine_textmate.ico" /Applications/ Second, open the icon in Preview, select all, copy, go to the Finder, do Get Info on, click on the icon on the top left of the window, and paste.


Jens Tinfors said...

Do you use TextMate for Java development? and if so, how are you coping with not having autocompletion of class/object members?
Also, what are you using for debugging?

Alessandro Vernet said...

Jens, I tried to use TextMate, being fed up with the slowness of tools like Eclipse and IntelliJ, but quickly came back to IntelliJ. Even if TextMate is simple and elegant, it just doesn't have enough power under the hood compared to what I am used to with IntelliJ.