Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm basically using TextMate only for its project drawer, find in project, and AckMate. What I'd like to do is automatically open the current file in another application (Aquamacs to be specific).

Is there a keyboard shotcut to open the current file in another/default application?
Or perhaps run some arbitrary shell script based on the current file?
Or at least copy the file path to clipboard?

If I could get the same functionality of these TextMate things (with the same usability and prettiness) in Aquamacs of course that'd be great too, but in my experience the TextMate tools are superior.

share|improve this question
I got the copy file path to clipboard part: – mark Oct 12 '11 at 19:02
solved my own problem... edited the bundle command to do this echo -n "$TM_FILEPATH" | xargs aquamacs – mark Oct 12 '11 at 19:23
You can answer your question yourself, using the appropriate button below! – slhck Oct 12 '11 at 19:46
up vote 3 down vote accepted

Here's an AppleScript solution that opens the current file in another application, but isn't limited to command line applications, but rather GUI ones:

  • Go to Bundles » Bundle Editor » Show Bundle Editor (or press ⌃ ⌥ ⌘ B).

  • Create a new bundle if you like, and add a new command (1). Then, give it a name you like (2).

    enter image description here

  • Copy and paste the following (3). I did this for TextEdit, but most other applications should work.

    open "$TM_FILEPATH" -a TextEdit

    Note: Aquamacs doesn't work with this, but you've found a workaround. With Aquamacs, it's enough to paste aquamacs "$TM_FILEPATH" instead of the open command.

  • Make sure to set Input to "None" and Output to "Discard".

  • Create an optional keyboard shortcut for it.

  • Close the bundle editor. Now you can call your new bundle command over Bundles » Your Bundle Name » Your Command Name or the shortcut you've set up.

share|improve this answer
Thanks. Is there any way to immediately execute a command once the application opens? Specifically I want to press "alt g g $TM_LINE_NUMBER" as soon as Aquamacs has opened up, in order to jump to that line number. – mark Oct 12 '11 at 22:04
@mark Just look at the answer I posted on your other question! You can use AppleScript for that. Worked for me. – slhck Oct 12 '11 at 22:05
$TM_FILEPATH isn't expanded inside single quotes. You could just use open "$TM_FILEPATH" -a TextEdit instead. – user495470 Sep 1 '12 at 6:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .