Created
January 25, 2016 18:30
-
-
Save andyperlitch/08c4ef2979a146169d9f to your computer and use it in GitHub Desktop.
Simple plugin for sublime to go to a file specified by a file
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
| import sublime, sublime_plugin | |
| class GoToRefCommand(sublime_plugin.TextCommand): | |
| def run(self, edit): | |
| pos = self.view.sel()[0].begin() | |
| region = self.view.extract_scope(pos) | |
| ref = self.view.substr(region).replace("'", "") | |
| folder = self.view.window().folders()[0] | |
| print("Going to ref: " + ref) | |
| # Check if there are any slashes | |
| if "/" in ref: | |
| self.view.window().open_file(folder + "/src/" + ref) | |
| else: | |
| print(ref) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment