89515e3f1f617a718f17d7a85405eaa6079651e6

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge pull request #711 from jasongill/textmate-plugin-improvement

Improvements to the tm command in the TextMate plugin

Diff

 1diff --git a/plugins/textmate/textmate.plugin.zsh b/plugins/textmate/textmate.plugin.zsh
 2index a11a097f5e32465476821d84893c729137e806ff..773c4f8d2ee3247f201962ee6986de6d52961a34 100644
 3--- a/plugins/textmate/textmate.plugin.zsh
 4+++ b/plugins/textmate/textmate.plugin.zsh
 5@@ -6,7 +6,16 @@ alias etts='mate app config lib db public script spec test vendor/plugins vendor
 6 # Edit Ruby app in TextMate
 7 alias mr='mate CHANGELOG app config db lib public script spec test'
 8 
 9+# If the tm command is called without an argument, open TextMate in the current directory
10+# If tm is passed a directory, cd to it and open it in TextMate
11+# If tm is passed a file, open it in TextMate
12 function tm() {
13-  cd $1
14-  mate $1
15+	if [[ -z $1 ]]; then
16+		mate .
17+	else
18+		mate $1
19+		if [[ -d $1 ]]; then
20+			cd $1
21+		fi
22+	fi
23 }