Skip to content

Instantly share code, notes, and snippets.

@mattfoster
Created December 15, 2008 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattfoster/35988 to your computer and use it in GitHub Desktop.
Save mattfoster/35988 to your computer and use it in GitHub Desktop.
<?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>commands</key>
<array>
<dict>
<key>argument</key>
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>#!/usr/bin/env python
# Add comments to the end of lines
import sys, os
comment_char = os.environ.get('TM_COMMENT_START', '#')
default_column = 55 # could set TM_DEFAULT_COMMENT_COL or similar
lines = sys.stdin.readlines()
lens = [len(s) for s in lines]
max_len = max([max(lens), default_column])
for line in lines:
print "%-*s %s" % (max_len, line.rstrip('\n').rstrip(), comment_char)
</string>
<key>fallbackInput</key>
<string>line</string>
<key>input</key>
<string>selection</string>
<key>name</key>
<string>end-of-line comments</string>
<key>output</key>
<string>replaceSelectedText</string>
<key>uuid</key>
<string>9596E382-6D7E-4980-9D97-6E5680B33BB8</string>
</dict>
<key>command</key>
<string>executeCommandWithOptions:</string>
</dict>
<dict>
<key>command</key>
<string>moveUp:</string>
</dict>
<dict>
<key>command</key>
<string>moveToEndOfLine:</string>
</dict>
<dict>
<key>argument</key>
<string> </string>
<key>command</key>
<string>insertText:</string>
</dict>
</array>
<key>name</key>
<string>EOL comments + reposition cursor.</string>
<key>uuid</key>
<string>8D5844FA-2BC2-4E53-BEE0-FF42E0848A74</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment