python-indent.vim


Ⅰ. 插件描述

A Vim indent plugin for Python which complies with PEP 8

Ⅱ. 基本信息

创建日期:  2015-05-10
使用用户:  2
Github星:  6
插件作者:  Akinori Hattori

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/hattya/python-indent.vim

Ⅳ. 文档说明

python-indent.vim

python-indent.vim is a Vim indent plugin for Python which complies with
PEP 8_.

.. image:: https://semaphoreci.com/api/v1/hattya/python-indent-vim/branches/master/badge.svg
:target: https://semaphoreci.com/hattya/python-indent-vim

.. image:: https://ci.appveyor.com/api/projects/status/j20153feidmt9vai/branch/master?svg=true
:target: https://ci.appveyor.com/project/hattya/python-indent-vim

.. image:: https://codecov.io/gh/hattya/python-indent.vim/branch/master/graph/badge.svg
:target: https://codecov.io/gh/hattya/python-indent.vim

.. _PEP 8: https://www.python.org/dev/peps/pep-0008/

Installation

pathogen.vim_

.. code:: console

$ cd ~/.vim/bundle
$ git clone https://github.com/hattya/python-indent.vim

Vundle_

.. code:: vim

Plugin 'hattya/python-indent.vim'

vim-plug_

.. code:: vim

Plug 'hattya/python-indent.vim', { 'for': 'python' }

dein.vim_

.. code:: vim

call dein#add('hattya/python-indent.vim')

.. _pathogen.vim: https://github.com/tpope/vim-pathogen
.. _Vundle: https://github.com/VundleVim/Vundle.vim
.. _vim-plug: https://github.com/junegunn/vim-plug
.. _dein.vim: https://github.com/Shougo/dein.vim

Configuration

g:python_indent_continue


Indent for a continuation line.

Default value: ``&sw``

.. code:: python

   value = 1 + \
       2 + \
       3
   value = func(
       1,
       2,
       3)


g:python_indent_right_bracket

If set to 1, a right bracket will be lined up under the first non-whitespace
character of the last line.

Default:

.. code:: python

value = [

   1,
   2,
   3,

]
value = func(

   1,
   2,
   3,

)

If set to 1:

.. code:: python

value = [

   1,
   2,
   3,
   ]

value = func(

   1,
   2,
   3,
   )

g:python_indent_multiline_statement


If set to ``1``, add some extra indentation on the conditional continuation line.

Default:

.. code:: python

   if (isinstance(path, str) and
       os.path.isfile(path)):
       pass

If set to ``1``:

.. code:: python

   if (isinstance(path, str) and
           os.path.isfile(path)):
       pass


Testing
-------

python-indent.vim uses themis.vim_ for testing.

.. code:: console

   $ cd /path/to/python-indent.vim
   $ git clone https://github.com/thinca/vim-themis
   $ ./vim-themis/bin/themis

.. _themis.vim: https://github.com/thinca/vim-themis


License
-------

添加新评论