# Omni Docs plugin for Sublime Text
A simple plugin for Sublime Text for jumping to documentation for:
1. selected symbols
2. imported modules / API
3. language reference
Some languages are supported out-of-the-box (see [Supported Languages](#languages-supported-out-of-the-box)) but other can be added by [customising the settings](#configuration).
The basic usage is pressing F1 when needing help; a panel will be shown with the possible options:
![Imgur](http://i.imgur.com/rQPqvou.png)
## Changelog
- **Version 1.2.0**:
+ setting `language_docs` can be a list
- **Version 1.1.0**:
+ added support for Sublime Text 2
+ added docs patterns for Erlang
## Installation
### Via Package Control
Make sure you have [**Package Control**](https://sublime.wbond.net/docs/usage) installed in Sublime Text and then press ctrl+shift+P, type "Install Package" and select "OmniDocs".
### Manual install
You can clone the [OmniDocs repository](https://github.com/bordaigorl/sublime-omnidocs) in your Sublime Text Package directory (accessible from the `Preferences > Browse Packages...` menu) with the command
git clone git@github.com:bordaigorl/sublime-omnidocs.git OmniDocs
or by downloading the last version of OmniDocs [here](https://github.com/bordaigorl/sublime-omnidocs/archive/master.zip) and extracting the contents to the Package directory.
## Contributing
If you manage to add support for languages and you think that could be useful for others please fork the repo on *GitHub* [here](https://github.com/bordaigorl/sublime-omnidocs) and submit a pull request.
## Usage
The plugin offers two commands: `omni_docs_panel` and `omni_docs_lookup`.
The command `omni_docs_panel` looks for imported modules in the current view or the currently open views, depending on settings, and displays a quick panel with the available documentation for them.
The `omni_docs_lookup` command looks up the current selection in the documentation.
The settings control, on a per-language basis, how the documentation should be accessed and shown; most of the presets open official online references but this can be fully customised in the settings, see [Configuration](#configuration).
### Key bindings and commands
The default keymap binds F1 so that when it is pressed:
* if something is selected then OmniDocs will search for the selected symbol in the docs for the current programming language;
* if nothing is selected a quick panel will display a list of the currently imported modules, allowing you to open the corresponding documentation with one click.
To see the available commands you can bring up the commands panel with ctrl+shift+P and typing "OmniDocs".
### Languages supported out-of-the-box
+ Python
+ Markdown (only syntax reference)
+ Haskell
+ LaTeX
+ Java
+ Scala
+ Erlang
Support for other languages can be easily added through the settings.
## Configuration
OmniDocs is designed to support any language, custom documentation sources and even other plugins. All you have to do to support a new language, change docs sources or call a custom command from OmniDocs, is changing few lines in the settings.
The settings can be customised in the file `OmniDocs.sublime-settings`. The settings can also be accessed from `Preferences > Package Preferences > Omni Docs`.
> **Note**: we call *import* any language construct that loads some documented external component; we call *modules* such components. Examples of imports are python's `import` statements or LaTeX' `\usepackage`. Examples of modules are python's `os.path` and LaTeX' `tikz`.
The basic structure of the settings is the following:
```
{
: {
"language_docs": {
"command": ,
"args":
},
"lookup_docs": {
"command": ,
"args":
},
"module_docs": {
,
"across_open_files": ,
"command": ,
"args":
}
},
...
}
```
The `` controls when the rules apply. It can be for example `text.html`; OmniDocs will look for the most specific selector for which there are rules. For example an entry `text.html.markdown` will be triggered in a markdown document even if an entry for `text.html` exists.
If the settings for a particular selector is left empty (i.e. `: {}`), then that scope will be disabled; similarly, you can disable a specific section by setting it to the empty object.
The special selector `default` will trigger when no selector matched the scope of the current selection.
`` can be any Sublime Text window-command, even provided by another plugin. For example `"command": "open_url", "args": {"url": }` will open `` in your browser.
The `` field can contain any of the [Build System variables](http://docs.sublimetext.info/en/latest/reference/build_systems.html#build-system-variables) plus