/vim-rfc

:notebook: Query RFC database and download RFCs from within Vim.

Primary LanguageVim ScriptMIT LicenseMIT

vim-rfc is a plugin for easy querying of the RFC database and loading RFC/STD documents into a Vim buffer.

(What is a RFC?)

vim-rfc in action!

If you use any of my plugins, please star them on github. It’s a great way of getting feedback and gives me the kick to put more time into their development. If you encounter any bugs or have feature requests, just open an issue report on Github.

Follow me: Twitter | SO

Installation

If you don’t have a plugin manager, I suggest having a look at vim-plug. Installation is a breeze afterwards:

call plug#begin('~/.vim/bundle')
  Plug 'mhinz/vim-rfc'
  Plug 'vim-scripts/rfc-syntax', { 'for': 'rfc' } " optional syntax highlighting for RFC files
call plug#end()

Restart Vim and :PlugInstall, then have a look at the docs: :h rfc.

Dependencies

This plugin requires Ruby support compiled into Vim: :echo has('ruby')

Additionaly, nokogiri is used as XML parser:

$ gem install nokogiri

Usage

.is really simple.

Query the database: :RFC <regexp>

Rebuild cache and query the database: :RFC! <regexp>

A new window with all matches will be shown. Now you can simply use <cr> to open the entry.

If you don’t want to open anything, hit q.

Tip
Since regular expressions are used, :RFC .* will list all documents. Makes it easy to search.

Configuration

There are no options, but you can change the default colors used in the window opened by :RFC. See :h rfc-colors.

Internals

If you use this plugin for the first time it downloads an index file from the internet. To parse that XML file a SAX parser, nokogiri, is used which is a event-driven XML parser written in C.

The parse tree is saved in a Ruby hash and written to a cachefile in YAML format. The file is located in ~/.vim-rfc.yml.

If you issue a query, the cachefile will be used for the lookup. The resulting hash will be provided back to the Vim environment.

At the end the index file will be removed, since it’s not needed anymore.

If you use the plugin for the second time, the cachefile will be used right away and downloading the 8 MiB index will be omitted.

License

MIT license. Copyright (c) 2015 Marco Hinz.