Sunday, August 31, 2008

Learn these keyboard shortcuts ...

... for better TextMate project window management.

First, open Keyboard.prefPane and map Control-Command-Z (^⌘Z) to "Zoom". (Detailed instructions can be found here, and the example he uses is this exact shortcut, in case you weren't convinced this is the right thing to do.)

Now open up a project in TextMate so that you've got the project drawer showing.

Ready? Here's your new keyboard calisthenic routine.

  • Control-Option-Command-D (^⌥⌘D or "mash D") to Hide Project Drawer
  • Control-Command-Z (^⌘Z) to Zoom the editor window to fill the screen
  • Control-Command-Z (^⌘Z) again to Zoom the editor window back to a size that can accommodate the project drawer
  • Control-Option-Command-D (^⌥⌘D or "mash D") again to Show Project Drawer
  • Option-Command-Backtick (⌥⌘`) to move focus to the drawer
  • Option-Down (⌥↓) to jump to the bottom of the drawer
  • Option-up (⌥↑) to jump to the top of the drawer
  • Option-Command-Backtick (⌥⌘`) again to move focus back to the editor
  • Again! Faster!

UPDATE: Note that the second Control-Command-Z (^⌘Z), while excellent exercise, isn't really necessary. TextMate will automatically zoom out the window if you ask for the project drawer and there isn't any room for it. Sweet!

4 comments:

renderful said...

Why not just use cmd-t and forgo the project drawer altogether? cmd-t and cmd-shift-t are by far the most useful keystrokes for project navigation I've found.

John Hume said...

I wasn't suggesting that those few commands are the only commands you should learn, just that they're worth learning (and in my pairing experience, rarely used).

I agree Cmd-T and Cmd-Shift-T are extremely useful, but they don't obviate use of the project drawer. Most obviously it's useful for browsing your project, but there are also many bundles that perform actions based on what's selected in the drawer (for example, the Git bundle).

Lejo said...

hey john,

You can use ctrl-tab and ctrl-shift-tab to shift between the editor and drawer.

John Hume said...

Cmd-Option-` is the standard shortcut for moving between drawer and main window (see System Preferences > Keyboard & Mouse > Keyboard Shortcuts > Keyboard Navigation > Move focus to the window drawer). Ctrl-Tab seems usually to be used to navigate sections of UI widgets. (Though in Firefox they've repurposed it to run through open tabs.) In TextMate it goes from the editor to the tree in the drawer to each of the four little buttons no one ever uses at the bottom of the drawer. But yeah, you can use Ctrl-Tab and Ctrl-Shift-Tab to move back and forth. I prefer a single keyboard shortcut that toggles, so I don't have to have a mental model where the editor and file tree are two nodes in a looped chain.