Ⅰ. 插件描述
A Vim plugin for writing JSON with JSON SchemaⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'quramy/vison'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'quramy/vison'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'quramy/vison'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/quramy/vison
Ⅳ. 文档说明
Vison is a Vim plugin to help writing *.json file with JSON Schema.
Vison provides the following features:
Completion keys or values in JSON files
- You can use more than 40 schema files provided by JSON Schema Store.
- Manegement JSON schema files.

How to install
Vison requires the following:
- git command
And, installation of the following Vim plugin is recommended:
If you use NeoBundle for Vim plugins management, append the following to your .vimrc:
NeoBundle 'Shougo/unite.vim'
NeoBundle 'Quramy/vison'And exec :NeoBundleInstall.
After installation, execute :VisonSetup command.
So, vison fetches schema file from JSON Schema Store.
You don't need exec this command at the next Vim launch.
Usage
Apply schema with command
To use omni-completion, you can call the :Vison command on the current buffer.
For example, start editing with vim package.json (NPM configuration file) and call :Vison package.json
If your current buffer's basename is equal to the schema name, you can omit the argument of this command.
Once a schema file is applied, you can complete keys or values in the current buffer with omni-completion(type <Ctrl-x><Ctrl-o>).
You can also configure your .vimrc for auto applying schema with autocmd.
For example:
autocmd BufRead,BufNewFile package.json Vison
autocmd BufRead,BufNewFile .bowerrc Vison bowerrc.jsonApply schema with Unite
If you have installed Unite, you can get a list of stored schema using :Unite vison.
And select a candidate, the selected schema apply to the current buffer.

Register schema files
Open some JSON schema file in Vim and exec :VisonRegisterSchema.
Then, the schema file is registered into the vison.
By the default, the schema file is copied into the ~/.cache/vison/default directory.
This command regards the basename of the current buffer as the schema name.
If the basename is package.json then the schema name is also package.json.
To set schema name explicitly, call this command with the argument.
For example :VisonRegisterSchema npm-package.
Customize completion
You can configure completion with the completeopt option.
If you don't want the popup menu:
autocmd FileType json setlocal completeopt-=menuIf you want to show more informations in the preview window when completion:
autocmd FileType json setlocal completeopt+=menu,previewCustomize schema store
T.B.D.
More details
If you want more details, please see doc/vison.txt.
License
MIT