Ⅰ. 插件描述
:notebook: Query RFC database and download RFCs from within Vim.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'mhinz/vim-rfc'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'mhinz/vim-rfc'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'mhinz/vim-rfc'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/mhinz/vim-rfc
Ⅳ. 文档说明
vim-rfc allows querying the RFC database and opening any RFC/STD document in
Vim.
- Includes a modified version of vim-scripts/rfc-syntax for RFC syntax highlighting.
Installation
Use your favorite plugin manager.
Using vim-plug:
Plug 'mhinz/vim-rfc'
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
List documents:
:RFC [regexp]Rebuild cache and list documents:
:RFC! [regexp]A new window with all matches will be shown. Use <cr> to open an entry or q
to quit. If there is only a single match, it gets opened right away.
Examples: :RFC, :RFC 100, :RFC http/2, :RFC ipv4 addresses.
Within a RFC document, if you are on a line from the table of contents,<c-]>/<cr> will jump to the referenced section. On a string like STD 10 orRFC 1234 (which should also be highlighted), it opens the referenced document
- Use
<c-o>to jump back.
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
- 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
- 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.
Author and Feedback
If you like my plugins, please star them on Github. It's a great way of getting
- Same goes for issues reports or feature requests.