Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

First version, handles projects with spaces and pipes

  • Loading branch information...
commit fdc164ae79fe17b86ea29f489eb957033b7f9380 0 parents
@indirect authored
Showing with 29 additions and 0 deletions.
  1. +11 −0 README.md
  2. +6 −0 setup.sh
  3. +12 −0 tm
11 README.md
@@ -0,0 +1,11 @@
+# tm
+
+## What?
+
+tm wraps `mate` in a warm, project-opening embrace. You can open TextMate project files by name, with tab-completion.
+
+## Installation
+
+Create `~/.tmproj` and save your TextMate projects into it. Check out this project, and put the `tm` binary somewhere you can execute it. Then you can just run `tm foo` to open `~/.tmproj/foo.tmproj`.
+
+For extra goodness, see `setup.sh`, which gives `mate` tm's powers, namely opening TextMate projects by name, and tab-completion entries for projects.
6 setup.sh
@@ -0,0 +1,6 @@
+# Just add tab-completion to `tm`
+complete -f -W '$(ls ~/.tmproj | sed s/.tmproj//)' tm
+
+# Also wrap `mate` with `tm` and add tab-completion
+alias mate='tm'
+complete -f -W '$(ls ~/.tmproj | sed s/.tmproj//)' mate
12 tm
@@ -0,0 +1,12 @@
+#!/usr/bin/env ruby
+
+proj_files = ARGV.map do |a|
+ File.expand_path("~/.tmproj/#{a}.tmproj")
+end
+
+if ARGV.any? && proj_files.all?{|p| File.exist?(p) }
+ exec %|open "#{proj_files.join('" "')}"|
+else
+ bash_args = ARGV.map{|s| s.gsub(' ', '\\ ') }
+ exec %|mate #{bash_args.join(" ")}|
+end
Please sign in to comment.
Something went wrong with that request. Please try again.