Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
47 lines (42 sloc) 1.24 KB
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//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>#!/usr/bin/env ruby18
def e (str); str.gsub(/[$`\\]/, '\\\\\0'); end
line = STDIN.read
col = ENV['TM_LINE_INDEX'].to_i
left, right = line[0...col], line[col..-1]
if left =~ /(.*?)(\[)?(\w+)\s+$/ then
lead, bracket, cl = $1, $2, $3
right = line[col+1..-1] unless bracket.nil?
if ENV.has_key?('TM_OBJC_MRR')
print "#{e lead}${1/.+/[/}[[#{e cl} alloc] init$2]${1: autorelease]}"
else
print "#{e lead}[[#{e cl} alloc] init$1]"
end
print right.empty? ? ";" : "#{e right}"
else
# this is only if we were not able to interpret the line
print "#{e left}$0#{e right}"
end
</string>
<key>fallbackInput</key>
<string>line</string>
<key>input</key>
<string>selection</string>
<key>name</key>
<string>Insert [[… alloc] init]</string>
<key>output</key>
<string>insertAsSnippet</string>
<key>scope</key>
<string>source.objc, source.objc++</string>
<key>tabTrigger</key>
<string>alloc</string>
<key>uuid</key>
<string>EA820F17-FD1D-4E7A-9961-E75F7D360968</string>
</dict>
</plist>