Created
June 20, 2014 20:51
-
-
Save Gerzer/47bc941a52119da636c0 to your computer and use it in GitHub Desktop.
Snakeyes.py
This file contains 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
import editor | |
full_text = editor.get_text() | |
cursor = editor.get_selection()[1] | |
while True: | |
try: | |
if full_text[cursor - 3] + full_text[cursor - 2] + full_text[cursor - 1] == 'def': | |
editor.replace_text(cursor, cursor, ' func_name():') | |
editor.set_selection(cursor + 1, cursor + 10) | |
if full_text[cursor - 3] + full_text[cursor - 2] + full_text[cursor - 1] == 'ifc': | |
editor.replace_text(cursor, cursor, ' condition:') | |
editor.set_selection(cursor + 1, cursor + 10) | |
if full_text[cursor - 3] + full_text[cursor - 2] + full_text[cursor - 1] == 'wlt': | |
editor.replace_text(cursor - 2, cursor, 'hile i < num:') | |
editor.set_selection(cursor + 7, cursor + 10) | |
if full_text[cursor - 3] + full_text[cursor - 2] + full_text[cursor - 1] == 'fea': | |
editor.replace_text(cursor - 2, cursor, 'or entry in array:') | |
editor.set_selection(cursor + 10, cursor + 15) | |
break | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment