mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-29 23:13:36 +00:00
43 lines
1.1 KiB
Plaintext
43 lines
1.1 KiB
Plaintext
<?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>#!/usr/bin/env ruby
|
|
|
|
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?
|
|
print "#{e lead}${1/.+/[/}[[#{e cl} alloc] init$0]"
|
|
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.js.objj</string>
|
|
<key>tabTrigger</key>
|
|
<string>alloc</string>
|
|
<key>uuid</key>
|
|
<string>DF55A80D-E733-4CE2-A318-D56789B18406</string>
|
|
</dict>
|
|
</plist>
|