30890b9eb9e1b6fc4b553d94a97424049bd6003e

Author
Jason Gill <jasongill@gmail.com>
Committer
Jason Gill <jasongill@gmail.com>
Date

Message

Fixes and improves the behavior of the tm command

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 }