<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -7,10 +7,38 @@
 	&lt;key&gt;command&lt;/key&gt;
 	&lt;string&gt;cat &amp;lt;&amp;lt;'RUBYEOF' &amp;gt; /tmp/ruby-amp-$$.rb
 
+require &quot;#{ENV['TM_SUPPORT_PATH']}/lib/ui.rb&quot;
+require &quot;#{ENV[&quot;TM_BUNDLE_SUPPORT&quot;]}/lib/ruby_tm_helpers.rb&quot;
+
 text = STDIN.read
-exit unless /^([\(\[\{\&amp;lt; ]*)([^,]+)(,\s*)(.+?)([\)\]\}\&amp;gt; ]*)$/.match(text)
 
-STDOUT &amp;lt;&amp;lt; &quot;#{$1}#{$4}#{$3}#{$2}#{$5}&quot;
+separator = TextMate::UI.request_string(:title =&amp;gt; &quot;Swap around what?&quot;, :prompt =&amp;gt; &quot;Blank, a string, or a regexp (like /=.?/)&quot;, :default =&amp;gt; &quot;,&quot;)
+
+if separator.nil?
+  exit_discard
+  exit
+end
+
+
+if separator =~ /^\/(.+)\/$/
+  separator = $1
+else
+  separator = &quot;\s*#{Regexp.escape(separator)}\s*&quot;
+end
+
+# containing parenthesis
+case text
+when /^\((.+)\)$/
+  prefix, text, suffix = '(', $1, ')'
+when /^\[(.+)\]$/
+  prefix, text, suffix = '[', $1, ']'
+when /^\{(.+)\}$/
+  prefix, text, suffix = '{', $1, '}'
+end
+
+exit unless /^(.+?)(#{separator})(.+)$/.match(text)
+
+STDOUT &amp;lt;&amp;lt; &quot;#{prefix}#{$3}#{$2}#{$1}#{suffix}&quot;
 
 RUBYEOF
 </diff>
      <filename>Commands/Swap Arguments.tmCommand</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>819fd8ab2111d31edebe3e5d163cf57dd6404698</id>
    </parent>
  </parents>
  <author>
    <name>Tim Harper</name>
    <email>timcharper@gmail.com</email>
  </author>
  <url>http://github.com/timcharper/rubyamp/commit/1d7f6af94c62a1b05280afd4abf61535719908ec</url>
  <id>1d7f6af94c62a1b05280afd4abf61535719908ec</id>
  <committed-date>2009-04-16T07:49:53-07:00</committed-date>
  <authored-date>2009-04-16T07:49:53-07:00</authored-date>
  <message>swap around anything</message>
  <tree>073e197e6e63375cd010380543d715131d63f277</tree>
  <committer>
    <name>Tim Harper</name>
    <email>timcharper@gmail.com</email>
  </committer>
</commit>
