vim-indent-object


Ⅰ. 插件描述

Vim plugin that defines a new text object representing lines of code at the same indent level. Useful for python/vim scripts, etc.

Ⅱ. 基本信息

创建日期:  2010-04-01
使用用户:  1518
Github星:  454
插件作者:  Michael Smith

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

## vim-indent-object

<!-- vim-markdown-toc GFM -->

<!-- vim-markdown-toc -->

Intro

Vim text objects provide a convenient way to select and operate on various
types of objects. These objects include regions surrounded by various types of
brackets and various parts of language (ie sentences, paragraphs, etc).

This plugin defines a new text object, based on indentation levels. This is
very useful in languages such as Python, in which the syntax defines scope in
terms of indentation. Using the objects defined in this plugin, an entire if
structure can be quickly selected, for example.

Install

  • vim-plug
Plug 'michaeljsmith/vim-indent-object'

Usage

This plugin defines two new text objects. These are very similar - they differ
only in whether they include the line below the block or not.

Key bindingsDescription
<count>aiAn Indentation level and line above.
<count>iiInner Indentation level (no line above).
<count>aIAn Indentation level and lines above/below.
<count>iIInner Indentation level (no lines above/below).

Note: the iI mapping is mostly included simply for completeness, it is
effectively a synonym for ii.

Just like regular text objects, these mappings can be used either with
operators expecting a motion, such as d or c, as well as in visual mode.

In visual mode the mapping can be repeated, which has the effect of
iteratively increasing the scope of indentation block selected. Specifying a
count can be used to achieve the same effect.

FeedBack

vim-indent-object was written by Michael Smith <msmith@msmith.id.au>. The
project repository is kept at:

http://github.com/michaeljsmith/vim-indent-object

Any feedback or criticism is welcome, and can be mailed to the author at the
above email address. Alternatively issues can be raised on the project
website.

添加新评论