Skip to content

Instantly share code, notes, and snippets.

@emilyst
Created August 15, 2012 20:47
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 emilyst/3363497 to your computer and use it in GitHub Desktop.
Save emilyst/3363497 to your computer and use it in GitHub Desktop.
SwitchToAndFromTest Sublime Plugin Beta
[
{ "keys": ["super+g", "super+t"], "command": "switch_to_from_test" }
]
import sublime
import sublime_plugin
import os.path
class SwitchToFromTestCommand(sublime_plugin.TextCommand):
def run(self, edit):
current_file_name = self.view.file_name()
if "TEST" in current_file_name:
self.view.window().open_file(current_file_name.replace("TEST/", ""))
else:
test_file_name = os.path.join(
os.path.dirname(current_file_name),
"TEST",
os.path.basename(current_file_name)
)
self.view.window().open_file(test_file_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment