- Script: Edit in TextMate
- Application: Finder
- Suggested key binding: ⇧⌘E
This script edits the Finder selection in TextMate. If there’s no selection, it’ll use the folder for the active Finder window. If there are no open windows, that’ll mean the Desktop.
finder = Appscript::app('Finder') paths = finder.selection.get(:result_type => :alias).map(&:path) paths << finder.insertion_location.get(:result_type => :file_ref).get(:result_type => :alias).path if paths.empty? system "mate", *paths unless paths.empty?
The effect is generally the same as if you dragged the selection onto the TextMate icon in the Dock or Finder toolbar. I.e. it’ll create a project window with all the files.
If you’d rather use another editor, replace
mate with whatever command your editor provides, e.g.
edit for TextWrangler.
This post of part of series on the scripts I use with FastScripts.
Got comments? Use reddit and/or poke me on twitter.