Quicksilver trigger: open with Textmate

September 20, 2007

Just made my best trigger yet! For those not in the know, quicksilver can be used to create custom short-cuts that do something when you press a certain key combination.

I had already made a open Gmail trigger, so I can open Gmail just as simple as command+option+g. This ones pretty nice, but the one I did today combines my favorite Mac app (Quicksilver) with my favorite Mac editor (Textmate).

One nice feature of Textmate is its ability to open folders and display their contents on a side drawer. The part that always bothered me was getting to the right folder while in Textmate. I usually had it opened in the Finder, but then would have to re-navigate to it when I wanted to edit files in the folder.

But No More!

For this trigger I turned on the proxy objects in the Quicksilver section of the Catalog.

proxy-on.png

This Gives you access to the ‘Current Selection’ proxy object, which represents what you have highlighted at any given time. Folders, files, whatever. It’s a very useful proxy.

Now we are able to create a trigger that opens the Current Selection (i.e. a folder) in Textmate.

Quicksilver textmate trigger

Assign this to your keychord of choice (I picked command+option+m but I don’t know if thats a good one) and you’re ready to use Textmate, via Quicksilver, all the more efficiently.

Update:

I found a problem with the key combination I choose, namely option+command+m is used to highlight text in the best pdf viewer / editor : Skim. So, what to do? I don’t like having three modifier keys as part of the key combination, so I didn’t really want to move to control+option+command+m.

So I took advantage of another Quicksilver feature that lets you limit where your triggers are used. If you open the information pane for your trigger, and select the ‘Scope’ tab, you can set limits or exceptions to the validity of your trigger.

scope.png

I could have also just disabled it in Skim, but so far I can’t think of another place this would be useful except in the Finder…

Btw: You just type the name of the program you want to limit the scope to – so type it right.


Getting to know TextMate | Part 1

March 4, 2007

At work, I was lucky enough to have them get me a copy of TextMate to be used for our up-coming experiments / projects with Ruby on Rails. TextMate is recommended by all the big RoR gurus and for good reason. It makes working with Rails all the more enjoyable and easy. Here’s some info on some of the things you should know about TextMate to make it worth the crazy money they charge for it.

Mac Key Notation:

It’s important to be on the same page, so here’s what all the icons you see here /everywhere mean.

key_icon_command.gif This is the command or apple key.

command The alt or option key.

key_icon_control.gif The control (ctrl) key.

key_icon_shift.gif The shift key.

Basics:

First, its a very good idea (especially in editing Rails applications) to open up a whole folder at a time, instead of single files. The great thing about TextMate is that it shows you the contents of the folder in a drawer, and you’ll be able to get to all the files in that directory via short-cut keys (as we’ll see in a bit). To open a folder, simply use the open pane to select a folder but no particular file inside that folder.

I like my drawer on the right side, but the initially, the drawer always seems to open on the left for me. To correct this

  • select View » hide project drawer
  • move the TextMate window over to the far left-hand corner of the screen
  • select: View » show project drawer

TextMate opens files as tabs in the main window. Navigating these tabs can be done easily via shortcuts. Check out the Navigation section for the details.

Top of the Window:

Hitting the ‘x’ for a tab will close this tab. This will also be the result of hitting : key_icon_command.gif+w

The circle which replaces the x on a tab indicates that the file has been modified but not saved.

Side of the Window:

Quick, go to : View » Gutter » Line Numbers
to turn on line numbering on the side. Don’t turn this off.

Bottom of the Window:

At the bottom of the window are a few fields that give you info about how you are editing the document:

picture-1.png — This indicates which ‘bundle’ package you are currently using. The bundle determines what short-cut keys are available to you as well as some other aspects of how the program functions, so its good to make sure this is correct for the file type you are using. Initially, when opening up a .rb file, TextMate sets this just to “Ruby”. If you are actually using TextMate for Rails, you’ll want to change that default. Once you change the bundle package for a particular file type, it is maintained for all files of that type

picture-2.png — This indicates what gets inserted when you hit the tab key. “Soft Tabs” indicates that its actually inserting spaces instead of tabs for indentation. Apparently 2 spaces is all the rage for Rails indenting.

Bracket Completion:

TextMate tries hard to make tedium disappear when writing code, and one spot that in which this is immediately apparent is when it starts adding closed parens / brackets / squiglies to your open ones automatically. Usually this is a good thing, but there are times when you need to get around these added brackets and not grab for the mouse. These will help:

  • key_icon_command.gif + return : Moves down one line but doesn’t move characters behind the cursor position down to that new line
  • key_icon_control.gif + f : Moves cursor to the right one position
  • Sometimes you just want one bracket, in these cases its best to be on the right-hand side of a word or hit : key_icon_shift.gif + right-arrow to select that rogue bracket.

File Navigation:

All the files opened in your drawer are accessible with a few button mashings.

  • key_icon_command.gif+t : opens the ‘go to file’ window. Just start typing the name of the file you want to go to and then hit return
  • key_icon_command.gif+key_icon_shift.gif+t : opens the ‘go to symbol’ window. This means different things for different file types, but in, for example, a Rails controller file, this will allow you to skip around the different methods (actions) in the file.

More to come:

We could write a whole blog on TextMate short-cut keys, but this will be enough for now. Next time will go into a bit of formatting and how to actually use the bundles provided.


New Keychords to know

April 23, 2006

Spent a bit of time figuring out some new short-cut-keys to make life all the more efficient on the mac.

The first new shortcut is a way to move around in text.

I have been using the command+left / right arrows to go to the front or back of a text line for some time. It’s a really nice way to quickly get around in paragraphs. But there are times when you need to get to the middle of a line quickly. So for this, I just found new short-cuts to jump through a line, one word at a time:

alt + left / right arrow.

Combine this with the shift key, and you can highlight one word at a time. Pretty nice.

Another handy use of the alt key is clicking on hyperlinks in web pages. Some times you don’t want to view the link, you want to download it (i.e. pdf’s). alt + mouseclick will download the link to your disk drive. A quick alternative to right-clicking (ctrl-clicking) and selecting “save link as…”

Finally, I have been looking for sometime now for a shortcut to canceling out of system prompts like the one pictured above. Well, this might not be an end-all solution, but it’s a good start:

command + .

Will select the cancel option automatically and close the prompt.

For other programs, when a prompt comes up that asks if you want to “save”, “don’t save”, or “cancel”, the options seemed to be mapped to:

command + . = cancel
command + d = don’t save
command + s = save

I’m not sure it these work for all prompts yet, or if only for those implemented in cocoa, but it’s a good start. Now I just need to figure out the password remeber shortcuts in Firefox…


Symbols say Something

April 8, 2006

SymbolsI really enjoy having folders on my Bookmark-Toolbar in Firefox. They allow me to group sites with similar themes, or sites I usually check at the same time.

But The toolbar can quickly fill up with wordy descriptions, and there's nothing worse than a filled Firefox toolbar. That's why I've started using symbols as indicators for what lies beneath. In the picture you can see my symbols for sites that change often (delta), security sites (squiggly S) and torrents ( the cross being fed with arrows). This way I associate the cool symbols with the actual things they represent (and I think it looks cool too).

To get these symbols, the alt / option key is your friend. Recently a friend of mine was happy to find out that the é symbol could be easily created using the alt+e, e combinition.

If you have trouble remembering whats underneath your standard keys Quicksilver can help. Simply start it up and start typing "Keyboard". It should come up with the "show keyboard viewer" application. This shows you what you are typing now and what are the possibilities from the various function keys.

This is a great little feature that I believe is built into the OS but Quicksilver makes it trivial to access. I plan on using this function to demonstrate different keyboard short-cuts to people in the future.


Short cut Keys are a way of Life!

April 28, 2005

There is little in the computing world that I enjoy better than shortcut keys. The mouse is to be avoided at all times. It slows you down, makes you weak. Like a frail old woman, with large bulbous fingers. Shortcut keys are one reason I like the Mac system so much. It’s full of standardized shortcuts that make me pen italian sonnets to show my love for them.

Note: I’ll use “apple” for the command key (the one with the apple on it)
and “ctrl” for the control key, because I’m lazy.

Obvious:
apple + c — copy
apple + x — cuts
apple + v — pastes
apple + z — undo (if available)

In the Finder (Desktop):
apple + tab — can switch between open applications very easily.
apple + h — hides an application
apple + q — quits an application
apple + w — closes windows
apple + delete — deletes item
shift + apple + delete — empties trash
shift + apple + n — makes a new folder
shift + apple + a — opens up to the “applications” folder

In Firefox:
apple + t — opens new tab
apple + n — opens new window
apple + w — closes current tab / window
ctrl + tab — switches between tabs
apple + l — highlights URL so you can go to a new location
apple + r — reloads page
/ — search on page — very helpful. try it now. do it.

General Text:
apple + left / right arrow — move to far right / left of line
apple + shift + left / right arrow — select all to the left / right

This is barely scratching the surface, but it’s a good start.
Here’s a link to apples shortcut site: ClickMe

What’s your favorite shortcut?