1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env ruby

require '/Applications/TextMate.app/Contents/SharedSupport/Support/lib/plist'

ARGV.each do |file|

  plist = PropertyList.load(open(file))
  name = plist['name']
  tabTrigger = Regexp::escape(plist['tabTrigger'].to_s)

  if name =~ /\A(.+)\b\s+\(#{tabTrigger}\)(.*)\z/ then
    plist['name'] = $1 + $2
    PropertyList.dump(open(file, 'w'), plist)
  end

end