A Vim plugin for writing JSON with JSON Schema
VimL Shell
Latest commit 97f2d03 Jul 15, 2015 @Quramy Fix typo
Permalink
Failed to load latest commit information.
autoload Fix store May 29, 2015
doc Modify doc Apr 27, 2015
plugin Add unite source Apr 23, 2015
vest Fix parser Apr 29, 2015
.gitignore Modify git ignore Apr 27, 2015
.travis.yml Add travis setting file Apr 22, 2015
README.md Fix typo Jul 15, 2015
capt_comp.png Update README Apr 27, 2015
capt_unite.png Update README Apr 27, 2015
runtest.sh First commit Apr 22, 2015

README.md

vison Build Status

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
  • Manegement JSON schema files.

capture

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.json

Apply 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.

capture

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-=menu

If you want to show more informations in the preview window when completion:

autocmd FileType json setlocal completeopt+=menu,preview

Customize schema store

T.B.D.

More details

If you want more details, please see doc/vison.txt.

License

MIT