Created
August 15, 2012 20:47
-
-
Save emilyst/3363497 to your computer and use it in GitHub Desktop.
SwitchToAndFromTest Sublime Plugin Beta
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
Show hidden characters
[ | |
{ "keys": ["super+g", "super+t"], "command": "switch_to_from_test" } | |
] |
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 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