/
Quick Open.plist
78 lines (72 loc) · 2.16 KB
/
Quick Open.plist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?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>command</key>
<string>#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -wKU
require ENV['TM_SUPPORT_PATH'] + '/lib/textmate.rb'
require ENV['TM_SUPPORT_PATH'] + '/lib/ui.rb'
def header
if ENV.has_key? 'TM_SELECTED_TEXT'
[:all, ENV['TM_SELECTED_TEXT']]
elsif ENV['TM_CURRENT_LINE'] =~ /#\s*(?:include|import)\s*([<"])(.*?)[">]/;
[$1 == '<' ? :system : :user, $2]
else
defaultText = %x{ /usr/bin/pbpaste -pboard find }
header = TextMate::UI.request_string :title => "Quick Open", :default => defaultText, :prompt => "Which header file do you wish to open?"
[:all, header]
end
end
def select_header(headers)
if headers.size > 1
menu = headers.map do |e|
header_name = $& if e =~ /[^\/]+$/
if e =~ /\.framework/
suffix = e.scan(/\/([^\/]+?).framework/).flatten.join(' → ')
else
suffix = File.split(e).first
end
{ 'path' => e, 'title' => "#{header_name} — #{suffix}" }
end
if res = TextMate::UI.menu(menu)
res['path']
else
nil
end
else
headers.first
end
end
domain, file = header()
exit if file.nil?
headers = %x{ "$TM_BUNDLE_SUPPORT/bin/headers" -s #{e_sh file} -d #{domain} -C "${TM_DIRECTORY}" }.split("\n")
if header = select_header(headers)
TextMate.go_to :file => header
elsif headers.empty?
abort "Unable to find ‘#{file}’."
end
</string>
<key>input</key>
<string>none</string>
<key>inputFormat</key>
<string>text</string>
<key>keyEquivalent</key>
<string>@D</string>
<key>name</key>
<string>Quick Open</string>
<key>outputCaret</key>
<string>afterOutput</string>
<key>outputFormat</key>
<string>text</string>
<key>outputLocation</key>
<string>toolTip</string>
<key>scope</key>
<string>source.c, source.objc, source.c++, source.objc++</string>
<key>uuid</key>
<string>FF0E22D6-7D78-11D9-B4DE-000A95A89C98</string>
<key>version</key>
<integer>2</integer>
</dict>
</plist>