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
  • 4 years ago
  • 7 minutes ago
  • 7 years ago

Installs

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

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