All Projects → jungomi → vim-mdnquery

jungomi / vim-mdnquery

Licence: MIT license
Query the Mozilla Developer Network documentation without leaving Vim

Programming Languages

Vim Script
2826 projects

Projects that are alternatives of or similar to vim-mdnquery

Google-Docs-for-Mac
Native Google Docs app for Mac
Stars: ✭ 33 (+73.68%)
Mutual labels:  docs
documentation
Documentation for dahliaOS
Stars: ✭ 78 (+310.53%)
Mutual labels:  docs
vapor-docs
The Vapor documentation.
Stars: ✭ 46 (+142.11%)
Mutual labels:  docs
vue-cli-3.x-doc-cn
vue-cli 3.x 中文文档
Stars: ✭ 49 (+157.89%)
Mutual labels:  docs
vim-textobj-anyblock
A text object for any of '', "", (), {}, [] and <>.
Stars: ✭ 76 (+300%)
Mutual labels:  vim-plugin
vim-readme-viewer
📖 Viewing plugin's README easily like vim help
Stars: ✭ 26 (+36.84%)
Mutual labels:  vim-plugin
blazor-docs
Public Documentation for Telerik UI for Blazor components.
Stars: ✭ 42 (+121.05%)
Mutual labels:  docs
docs
Unleash Bitcoin's full potential with decentralized apps and smart contracts. The documentation covers key aspects of the Stacks network and technology and provides tutorials and other helpful content for developers.
Stars: ✭ 134 (+605.26%)
Mutual labels:  docs
searchReplace.vim
Search & Replace, simply & efficiently [neovim only]
Stars: ✭ 26 (+36.84%)
Mutual labels:  vim-plugin
fusionauth-site
Website and documentation for FusionAuth
Stars: ✭ 24 (+26.32%)
Mutual labels:  docs
vim-shellcheck
Vim wrapper for ShellCheck, a static analysis tool for shell scripts.
Stars: ✭ 63 (+231.58%)
Mutual labels:  vim-plugin
nvim-contabs
contextual tabs for vim/neovim
Stars: ✭ 20 (+5.26%)
Mutual labels:  vim-plugin
PICO-8.vim
A vim plugin package for PICO-8 programming.
Stars: ✭ 42 (+121.05%)
Mutual labels:  vim-plugin
taxonworks doc
TaxonWorks (https://taxonworks.org) documentation.
Stars: ✭ 13 (-31.58%)
Mutual labels:  docs
teedoc
wiki and multi docs friendly static document site generator(doc generator), convert markdown and jupyter notebook to html website. wiki 和多文档友好的静态文档网站生成工具
Stars: ✭ 72 (+278.95%)
Mutual labels:  docs
posthog.com
Official docs, website, and handbook for PostHog.
Stars: ✭ 147 (+673.68%)
Mutual labels:  docs
vim-solidity
Syntax highlighting for Solidity in Vim
Stars: ✭ 44 (+131.58%)
Mutual labels:  vim-plugin
vim-pairs
Punctuation text objects: ci/ da; vi@ yiq da<space> ...
Stars: ✭ 35 (+84.21%)
Mutual labels:  vim-plugin
purescript-resources
This is a repository for a docs site on how to figure things out in PureScript as recommended by me.
Stars: ✭ 47 (+147.37%)
Mutual labels:  docs
miniSnip
Lightweight snippet plugin for Vim
Stars: ✭ 45 (+136.84%)
Mutual labels:  vim-plugin

Vim-MdnQuery

Query the Mozilla Developer Network documentation without leaving Vim. The network requests are done asynchronously if the job-control feature is available (both in NeoVim and Vim), otherwise it falls back to using Ruby. To avoid unnecessary requests, the search results and documentation entries are cached in the current Vim instance, which allows to switch quickly between them.

Demo

Requirements

  • NeoVim or Vim with the job-control feature for asynchronous execution.
  • Vim compiled with Ruby support when job-control is not available.
  • The gem mdn_query.

Installation

gem install mdn_query

Install the plugin with your favourite plugin manager.

Example using vim-plug

Add the following to ~/.vimrc or ~/.config/nvim/init.vim respectively:

Plug 'jungomi/vim-mdnquery'

Reload the config file and install the plugins:

:source $MYVIMRC
:PlugInstall

Usage

Simple Search

:MdnQuery array remove

Searches for array remove and shows the list of results in a buffer when the search finishes. Inside the buffer you can open the entry under the cursor by pressing <Enter>. When showing an entry you can press r to return to the list of results.

Often a search query is specific enough that the first result in the list is the one that will be opened. Doing that manually would quickly become annoying and for this reason :MdnQueryFirstMatch exists, which automatically opens the first entry.

:MdnQueryFirstMatch array.pop

Keywordprg (K command)

The K command is used to lookup documentation for the word under the cursor. It defaults to man on Unix and :help otherwise. The default behaviour is not very useful for many file types. This plugin automatically changes that for JavaScript files . Pressing K in normal mode uses this plugin to search for the word under the cursor.

It might be useful to also have this behaviour for other file types, so you can use a simple autocommand to set it for them:

autocmd FileType html setlocal keywordprg=:MdnQueryFirstMatch

See :help mdnquery-keyworprg for more details.

Topics

The search is limited to the topics specified in g:mdnquery_topics, which is a list of topics and defaults to ['js']. Having a global list of topics for all searches might show some undesired results. Instead of having to change the global option, you can set b:mdnquery_topics, which is local to the current buffer and is used over the global one if it exists. This can easily be combined with an autocommand to set the correct topics for a specific file type.

" Search in JS and CSS topics
let g:mdnquery_topics = ['js', 'css']
" Search only for HTML in the current buffer
let b:mdnquery_topics = ['html']

" Automatically set the topics for HTML files
autocmd FileType html let b:mdnquery_topics = ['css', 'html']

If you would like to execute a search for specific topics without having to change any settings, you can use the functions mdnquery#search(query, topics) and mdnquery#firstMatch(query, topics).

call mdnquery#search('link', ['css', 'html'])
call mdnquery#firstMatch('flex align', ['css'])

Buffer appearance

By default the buffer appears after a search is completed and it is not automatically focused. You can change this behaviour by changing the g:mdnquery_show_on_invoke and g:mdnquery_auto_focus settings. The buffer is opened with the :botright command and therefore appears at full width on the bottom of the screen or when g:mdnquery_vertical is set, it appears at full height on the very right of the screen. The size of the buffer can be changed with the g:mdnquery_size setting. For example to automatically show and focus the window with a height of 10 lines, this configuration can be used:

let g:mdnquery_show_on_invoke = 1
let g:mdnquery_auto_focus = 1
let g:mdnquery_size = 10

If you prefer to only focus the buffer when a search is finished, you can use the following autocommand instead of setting g:mdnquery_auto_focus:

autocmd User MdnQueryContentChange call mdnquery#focus()

See :help mdnquery-settings for the full list of settings.

Documentation

For additional and more detailed information take a look at the plugin's help.

:help mdnquery.txt

Known Issues

Only for Vim versions without the job-control feature.

LoadError: incompatible library version - Nokogiri

This error occurs when using a Ruby installed with RVM but Vim was compiled with system ruby. To fix it tell RVM to use system Ruby and then reinstall the gem, or simply get a Vim version with job-control support.

rvm use system
gem install mdn_query
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].