Posted By

koncept on 01/24/09


command textmate Bash snippet

Versions (?)

Who likes this?

4 people have marked this snippet as a favorite


TextMate command snippet - show document path in window title

 / Published in: Bash

  1. Create a new Command: Bundles > Bundle Editor > Edit Commands
  2. Click the "+" button to add a new command
  3. Give your command a descriptive name ("TM Path in title", for example)
  4. Set the following properties on the command: {save:Nothing, Input:None, Output:Show as Tool Tip, Activation:⌥⌘T, Scope Selector: NULL}
  5. Close the command window
  6. Test out a document inside a project. The title should be replaced with an absolute path based on the root directory of your project.

Feedback and improvements are absolutely welcome. I'm looking to find a way to automatically fire this when a document is opened. Anybody know if this is possible?

  1. #!/bin/bash
  3. B=${A##*/}
  4. C=${TM_FILEPATH:-""}
  5. D=${C/$A/\/$B}
  6. [[ ! -z $C ]] && { osascript -e "tell application \"TextMate\" to set name of window 1 to \"$D\""; }
  7. :

Report this snippet  


RSS Icon Subscribe to comments
Posted By: mblarsen on March 2, 2011

You could change the activation key to ⌘ + S so when the document is saved it will set the path.

Posted By: mrAlexGray on April 27, 2014


You need to login to post a comment.