ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Goto​Documentation

by kemayo ST2/ST3

Sublime Text 2 plugin to go to documentation

Details

  • 2014.11.13.15.13.51
  • github.​com
  • github.​com
  • 3 years ago
  • 28 minutes ago
  • 6 years ago

Installs

  • Total 57K
  • Win 30K
  • OS X 15K
  • Linux 12K
Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3
Windows 10 9 6 9 21 14 17 20 11 1 13 10 7 26 16 6 6 7 15 17 10 13 13 12 10 10 8 14 18 14 15 19 13 13 18 10 5 16 16 8 12 17 14 13 7 15
OS X 2 2 4 3 4 5 4 5 4 3 3 0 6 2 3 1 1 5 4 7 3 3 6 1 5 0 2 8 6 0 1 6 3 6 4 8 3 2 1 6 3 2 3 3 4 4
Linux 5 1 2 4 8 2 2 10 3 5 3 5 8 5 3 2 4 5 9 1 6 5 3 1 3 3 1 5 4 5 3 3 5 4 14 10 2 5 6 5 2 2 3 4 5 6

Readme

Source
raw.​githubusercontent.​com

GotoDocumentation

A Sublime Text plugin to jump to documentation for the current keyword.

Supports

  • PHP
  • JS / CoffeeScript
  • HTML
  • CSS/SASS/LESS
  • Python (via pydoc)
  • Clojure
  • Go
  • Ruby (+Rails)
  • C / C++
  • Perl
  • C#
  • Lua
  • Postgres
  • Erlang
  • Smarty
  • Haskell
  • …you can add any other language via settings

Installation

Via Package Control
Search for GotoDocumentation

Manually
Clone this project in your Packages folder under the name GotoDocumentation.
git clone https://github.com/kemayo/sublime-text-2-goto-documentation.git GotoDocumentation

How to use

Move the cursor inside the word you want the docs for and: * Press Super+Shift+H or
* Open command palette (Ctrl+Shift+P) and search for for GotoDocumentation

Edit the urls

GotoDocumentation allows you to edit the url that opens by editing the settings.

The available settings are:

{
    "prefix": "", // added at the begging of the query
    "suffix": "", // added at the end of the query
    "docs": { // obj containing the docs for each scope
              // these are merged with the default ones


        // the key value pair represent scope -> doc url
        // supported placeholders:
        //  - %(query)s the selected text/word
        //  - %(scope)s the current scope
       "css": "http://devdocs.io/#q=%(scope)s+%(query)s",

        // we can also have an object to
        // run a command for finding docs
        // inside the command you can use the same placeholders
        "python": {
            // the command to be executed
            "command": ["python", "-m", "pydoc", "%(query)s"],
            // a regex to determine if this was an invalid response from the console
            "failTest": ".*no Python documentation found for.*",
            // regex to select something from the valid response
            "changeMatch": "(Related help topics)",
            // regex to replace the matched result
            "changeWith": "-------\n\\1",
            // fallback url: if failTest returns true this will be used
            "url": "http://docs.python.org/3/search.html?q=%(query)s"
        }
    },
    // if we have no docs for the current scope
    // we will try using the fallback one,
    // to disable set to false
    "fallback_scope": "google"
}

The change replace is done with the re.sub method

How to get the scope

To get the scope for a specific place open your sublime console with ctrl + ` and paste in this command view.scope_name(view.sel()[0].begin()).rpartition('.')[2].strip()
You can then use that scope to set a rule in the docs dictionary(object).

Contributions

Submit a patch adding more and I'll include it.

If you find a bug or have suggestions open an issue here