beforeRunningCommand nop command #!/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 fallbackInput line input selection name Insert [[… alloc] init] output insertAsSnippet scope source.js.objj tabTrigger alloc uuid DF55A80D-E733-4CE2-A318-D56789B18406