vim-yaml-formatter


Ⅰ. 插件描述

Vim Plugin for YAML formatting

Ⅱ. 基本信息

创建日期:  2017-07-19
使用用户:  21
Github星:  6
插件作者:  Tarek Becker

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'tarekbecker/vim-yaml-formatter'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'tarekbecker/vim-yaml-formatter'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'tarekbecker/vim-yaml-formatter'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/tarekbecker/vim-yaml-formatter

Ⅳ. 文档说明

==================

VIM YAML Formatter

Prerequisite

Python package pyyaml need to be installed.

.. code-block:: bash

 pip install pyyaml

Installation

Using Vundle <https://github.com/VundleVim/Vundle.vim#about>_:

.. code-block:: vim

 Plugin 'tarekbecker/vim-yaml-formatter'

Usage

Execute YAMLFormat to format the current buffer

.. code-block:: vim

 :YAMLFormat

A range formatting is not supported.

Configuration

VIM's configuration tabstop determines the number of spaces used for
indention.

Per default collection items have the same indention level as their parent:

.. code-block:: yaml

 name:
 - item
 - item

yaml_formatter_indent_collection=1 can be used to indent the items:

.. code-block:: yaml

 name:
      - item
      - item

.. code-block:: vim

 let g:yaml_formatter_indent_collection=1

添加新评论