Need help with vim-indent-object?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

michaeljsmith
516 Stars 44 Forks 46 Commits 13 Opened issues

Description

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

Services available

!
?

Need anything else?

Contributors list

# 180,295
Less
Shell
CSS
Node.js
7 commits
# 725,720
4 commits
# 977
Neovim
vimrc
spacevi...
pony-la...
1 commit
# 389,611
Shell
svg
sprocke...
Rails
1 commit
# 124,179
Shell
HTML
Gulp
Mobile
1 commit

vim-indent-object

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 bindings | Description | | ------------ | ----------------------------------------------------------- | |

ai
| An Indentation level and line above. | |
ii
| Inner Indentation level (no line above). | |
aI
| An Indentation level and lines above/below. | |
iI
| Inner 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 [email protected]. 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.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.