Skip to content

Instantly share code, notes, and snippets.

@andyperlitch
Created January 25, 2016 18:30
Show Gist options
  • Save andyperlitch/08c4ef2979a146169d9f to your computer and use it in GitHub Desktop.
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
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