Skip to content

Instantly share code, notes, and snippets.

@henrik
Created June 13, 2009 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save henrik/129167 to your computer and use it in GitHub Desktop.
Save henrik/129167 to your computer and use it in GitHub Desktop.
TextMate "Open Finder" command: http://henrik.nyh.se/2009/06/tm-open-finder
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>bundleUUID</key>
<string>5A9D4FC6-6CBE-11D9-A21B-000D93589AF6</string>
<key>command</key>
<string>#!/usr/bin/env ruby
DIR = ENV['TM_SELECTED_FILE'] || ENV['TM_FILEPATH'] ||
ENV['TM_DIRECTORY'] || ENV['TM_PROJECT_DIRECTORY'] || ENV['HOME']
if File.directory?(DIR)
system("open", DIR)
else
system('osascript', '-e', 'tell app "Finder"', '-e',
%{reveal Posix file #{DIR.inspect}},
'-e', 'activate', '-e', 'end')
end</string>
<key>input</key>
<string>none</string>
<key>keyEquivalent</key>
<string>^O</string>
<key>name</key>
<string>Open Finder</string>
<key>output</key>
<string>discard</string>
<key>uuid</key>
<string>955D9155-7E3D-4A96-A1E9-D87D911B65DD</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment