beforeRunningCommand nop bundleUUID 4675A940-6227-11D9-BFB1-000D93589AF6 command #!/usr/bin/ruby lines = Array.new # Read in lines STDIN.readlines.each do |line| match = line.strip.match(/#define (\S+)\s+(.*)/) if (match) lines << { :constant => match[1], :value => match[2] } else lines << line.rstrip end end # Find longest constant constant_size = 0; lines.each do |line| if (line.class == Hash && line[:constant].length > constant_size) constant_size = line[:constant].length end end # Up size to next multiple of the tab size: tab_size = ENV['TM_TAB_SIZE'].to_i constant_size = constant_size + (tab_size - (constant_size % tab_size)) # Format output lines.each do |line| if (line.class == Hash) printf("#define %-#{constant_size}s%s\n", line[:constant], line[:value]) else puts line end end fallbackInput line input selection name Reformat defines output replaceSelectedText uuid 0C713212-A967-48F3-A199-6D553C911BB2