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.

Revisions

  1. andyperlitch created this gist Jan 25, 2016.
    16 changes: 16 additions & 0 deletions go_to_ref.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    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)