Created
May 9, 2014 14:16
-
-
Save persquare/6e937f61a3b30cb1aba9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python -S | |
| #encoding: utf-8 | |
| # For TM2:TextTasks | |
| # Settings: | |
| # Input::Line::Text | |
| # output::Replace input::Snippet | |
| import os | |
| import sys | |
| import re | |
| # FIXME: | |
| INDENT = ' ' | |
| tm_support_path = os.environ['TM_BUNDLE_SUPPORT'] | |
| if tm_support_path not in sys.path: | |
| sys.path.insert(0, tm_support_path) | |
| import exit_codes as exit | |
| if os.environ.get('TM_SELECTED_TEXT', None): | |
| # If there is a selection I can't get access to the line?! Bail. | |
| exit.discard() | |
| line = os.environ.get('TM_CURRENT_LINE') | |
| line = line.rstrip('\r\n ') | |
| col = int(os.environ.get('TM_LINE_INDEX')) | |
| line = INDENT + line[0:col] + '${0}' + line[col:] | |
| sys.stdout.write(line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment