Ⅰ. 插件描述
Vim plugin for code completion and schema validation of YAMLⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'mkasa/neco-yaml-kwalify-schema'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'mkasa/neco-yaml-kwalify-schema'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'mkasa/neco-yaml-kwalify-schema'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/mkasa/neco-yaml-kwalify-schema
Ⅳ. 文档说明
# What is "neco-yaml-kwalify-schema"?
neco-yaml-kwalify-schema is a vim plugin for
schema-aware completion and validation for YAML files.
What it provides when you edit a YAML file on vim are:
- syntax checking (requires Syntastic)
- schema validation (requires Kwalify)
- code completion (requires Neocomplete)
- autohelp (requires Neocomplete).
Screenshots
Syntax checking:

Schema validation:

Schema-aware completion:
Autohelp:
Installation
neco-yaml-kwalify-schema depends on the following plugins or software:
- Syntastic (https://github.com/scrooloose/syntastic)
- Kwalify (http://www.kuwata-lab.com/kwalify/)
- Neocomplete (https://github.com/Shougo/neocomplete.vim)
- Ruby (a support script of the plugin is written in Ruby)
I don't explain how to install a vim plugin, but basically you can use
whatever plugin managers, such as Pathogen or Neobundle.
Next you need to put bin/kwalify-check in any directory on PATH. Please make
sure that kwalify is also somewhere on PATH. If you see
neco-yaml-kwalify-schema complain Kwalify or kwalify-check cannot be executed,
please check the PATH environment variable. Note that PATH that vim uses
might be different from what you use (e.g.,
http://stackoverflow.com/questions/12691814/path-in-vim-is-different-from-which-in-shell-mac-osx)
You might need to upgrade your vim to enjoy better syntax highlighting and
better autoindent, because YAML support (i.e., the default YAML ftplugin) in
older versions of vim is not good enough.
Basic Usage
Enable Neocomplete and Syntastic for YAML. If you installed the both plugins
successfully, they are enabled by default so you do not have to do anything.
If you only need syntax checking, you are already all set.
To turn on schema validation, you need to tell the plugin where you put the
schema file. We use a comment for that. We assume the schema file is at
/home/foo/schema.yml, then you need to put the following comment in a YAML
file you are editing.
# Schema: /home/foo/schema.ymlThis comment can be anywhere in the file so you can put it in the head of
the file or the tail of the file, or even in the middle. It is searched by
a simple regular expression, so it can be put in non-comment regions if
you wish, although not recommended. Anyway, the plugin passes to Kwalify
/home/foo/schema.yml as a schema file. If you specify a relative path,
it becomes relative to "~/.kwalify". Once you set this comment, you see
the code completion and the autohelp working.
License
neco-yaml-kwalify-schema is distributed under the MIT license.