TextMate命令段-在窗口标题中显示文档路径

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了TextMate命令段-在窗口标题中显示文档路径相关的知识,希望对你有一定的参考价值。

##Instructions
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
  2. A=${TM_PROJECT_DIRECTORY:-""}
  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. :

以上是关于TextMate命令段-在窗口标题中显示文档路径的主要内容,如果未能解决你的问题,请参考以下文章

Textmate c++ 编译错误

(Java) 在 macbook 中使用 Textmate 时,如何在 File 类中创建完整路径?

使用TextMate&ŧ039;s tmŧdialog命令显示警报框

在 TextMate 中突出显示 Intel 和 AT&T 汇编语法

TextMate Ruby代码段检索

HTML HTML5 TextMate代码段