Permalink
Browse files

gsub snippet useful for cleaning multi-line strings

  • Loading branch information...
1 parent 2cff40d commit cb964897ff86a9200f5cb59c314c93e2b70b9e61 @drnic committed Dec 29, 2008
Showing with 42 additions and 0 deletions.
  1. +32 −0 Commands/gsub - remove whitespace from front of line.tmCommand
  2. +10 −0 info.plist
@@ -0,0 +1,32 @@
+<?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 -w
+
+whitespace = ""
+if ENV['TM_CURRENT_LINE'] =~ /^([\s\t]+)/
+ whitespace = $1.gsub(/\t/, '\t')
+end
+
+print "gsub(/${1:^#{whitespace}}/, '$0')"
+</string>
+ <key>fallbackInput</key>
+ <string>none</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>name</key>
+ <string>gsub - remove whitespace from front of line</string>
+ <key>output</key>
+ <string>insertAsSnippet</string>
+ <key>scope</key>
+ <string>source.ruby</string>
+ <key>tabTrigger</key>
+ <string>gsub</string>
+ <key>uuid</key>
+ <string>B3875596-723C-41EE-9E6F-F84930C3B568</string>
+</dict>
+</plist>
View
@@ -460,6 +460,7 @@
<string>6519CB08-8326-4B77-A251-54722FFBFC1F</string>
<string>47D203ED-EB9B-4653-A07B-A897800CEB76</string>
<string>E07FF68B-C87D-4332-8477-D026929FDADA</string>
+ <string>B3875596-723C-41EE-9E6F-F84930C3B568</string>
<string>7990EE60-C850-4779-A8C0-7FD2C853B99B</string>
<string>121B334B-2AA6-4E9A-A8B8-BF93B627982B</string>
<string>58FDEA60-10AF-4C49-AA09-29B77030DB25</string>
@@ -628,6 +629,15 @@
<string>6D75102B-6E51-4360-8F12-BE12327B6AE6</string>
<string>AEDD6A5F-417F-4177-8589-B07518ACA9DE</string>
<string>1A7701FA-D866-498C-AD4C-7846538DB535</string>
+ <string>8EBBB26F-980E-404E-8366-74E5772298F6</string>
+ <string>397FA09F-A30F-4EE4-920C-318D5004EE97</string>
+ <string>50C56AC8-48F3-42A0-AF10-8164464AFAEF</string>
+ <string>C122CD92-DDBE-4869-9C7A-CC2B254C9411</string>
+ <string>678BDB83-FBBD-4E8E-BE0B-E1A98AECB247</string>
+ <string>05EE1046-5ED7-48F5-8693-1F066163B2F4</string>
+ <string>34FEBB9F-73CD-4DD4-A0A3-1CF2A5E3DE78</string>
+ <string>33969819-62C5-4E03-B824-C2337205F364</string>
+ <string>A7BF14E6-59B1-42E5-8755-8A72BF13685E</string>
</array>
<key>uuid</key>
<string>467B298F-6227-11D9-BFB1-000D93589AF6</string>

0 comments on commit cb96489

Please sign in to comment.