diff --git a/Commands/convert this to self.tmCommand b/Commands/convert this to self.tmCommand new file mode 100644 index 0000000..236e736 --- /dev/null +++ b/Commands/convert this to self.tmCommand @@ -0,0 +1,40 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env ruby + +code = STDIN.read + +if code =~ /\bself\b/ + + code.gsub!(/(\s*var\s+)?self\s+=\s+this\s*;?\s*$\n?/,'') + code.gsub!(/\bself\b/,'this') + +else + code.gsub!(/\bthis\b/,'self') + indent = code.split("\n")[0].match(/^\s*/)[0] + code = "#{indent}var self = this;\n" << code +end + +print code + + fallbackInput + line + input + selection + keyEquivalent + ^@S + name + convert this to self + output + replaceSelectedText + scope + source.js + uuid + F035D69A-8987-459C-8425-090752784BC4 + + diff --git a/info.plist b/info.plist index c07f986..9f9b227 100644 --- a/info.plist +++ b/info.plist @@ -194,6 +194,7 @@ 2831C11D-1907-4BC1-9A4D-BEE70EAFD0CF ED5F2161-F404-45EA-A8CD-5A4C0CB18DFF 1C062C73-8798-4794-8F4A-223012E42A07 + F035D69A-8987-459C-8425-090752784BC4 uuid AAB4FD74-73F9-11D9-B89A-000D93589AF6