Open devdocs.io from Vim
Vim script Ruby
Latest commit 4ee0c77 Mar 5, 2016 @rhysd Merge pull request #3 from chrisww/windows-compatibility
Fix s:open_fallback() on windows
Permalink
Failed to load latest commit information.
autoload Fix s:open_fallback() on windows Mar 5, 2016
doc add documentation Nov 10, 2015
plugin fix command error Nov 15, 2015
test add tests Nov 10, 2015
.travis.yml
README.md run CI on Travis Nov 10, 2015

README.md

devdocs.vim

Build Status

This is a Vim plugin for devdocs, which is an awesome multiple API documentation service. You can open and search devdocs from Vim.

  • Open and search devdocs using command :DevDocs or :DevDocsAll
  • Relate filetype to specific documentation.
  • Search word under the cursor.

Usage

  • :DevDocs [query] : Search with query with filetype related documentation (query can be omitted)
  • :DevDocsAll [query] : Search with query with all documentation (query can be omitted)

Cusomize

Mapping K to search under the word quickly

devdocs.vim doesn't overrides any mapping by default. You should define key mappings if you need.

If you always want to override K mapping,

nmap K <Plug>(devdocs-under-cursor)

If you want to override K mapping in specific filetypes,

augroup plugin-devdocs
  autocmd!
  autocmd FileType c,cpp,rust,haskell,python nmap <buffer>K <Plug>(devdocs-under-cursor)
augroup END

Above replaces K in C, C++, Rust, Haskell, and Python.

Open with specific documenation on specific filetype

You can customize relationship between Vim's filetype and documenation. Below is an example of customization.

let g:devdocs_filetype_map = {
    \   'ruby': 'rails',
    \   'javascript.jsx': 'react',
    \   'javascript.test': 'chai',
    \ }

With above configuration, :DevDocs blah searches Rails documentation on filetype ruby.

:DevDocsAll searches all documentation ignoring filetype relation and below configuration explicitly disable this feature.

let g:devdocs_filetype_map = { '*': '' }

Open local devdocs

You can easily host local devdocs. If your local devdocs is hosted to localhost:9292, devdocs.vim uses it by following configuration.

let g:devdocs_host = 'localhost:9292'

Make a command for specific document

You can use devdocs#open_doc() function to make such a command.

Below is an example for :DevDocsReact command to open page with 'react' documentation

command! -nargs=* DevDocsReact call devdocs#open_doc(<q-args>, 'react')

You can execute as below,

:DevDocsReact
:DevDocsReact componentDidMount

License

Copyright (c) 2015 rhysd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
THE USE OR OTHER DEALINGS IN THE SOFTWARE.