Skip to content

pianohacker/vim-textobj-indented-paragraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

vim-textobj-indented-paragraph

Provides text objects and movements for indented paragraphs.

Text objects:

  • ir - current paragraph, indented same or more than current line
  • ar - same as above, including surrounding empty lines

Movements:

  • g) - move to the next beginning of an indented paragraph
  • g( - move to the previous beginning of an indented paragraph

Examples

Text Objects

Given the following code (with the cursor at |):

if (condition) {
    result = operation();|
    if (!result) return false;

    operation2();
}

dir will result in:

if (condition) {

    operation2();
}

and dar will result in:

if (condition) {
    operation2();
}

Note that dar in a block with empty lines on both sides will leave empty lines behind; given:

if (a) {
    b();

    c();|

    d();
}

dar will result in:

if (a) {
    b();

    d();
}

Movement

Given the following code (with the cursor at |):

if (condition) {
    result = operation();
    if (!result) return false;|

    operation2();
}

g) will move to:

if (condition) {
    result = operation();
    if (!result) return false;

    |operation2();
}

and g( will move to:

if (condition) {
    |result = operation();
    if (!result) return false;

    operation2();
}

Dependencies

Installation

First, add the necessary line to your vimrc:

  • Vundle - Bundle 'pianohacker/vim-textobj-indented-paragraph'
  • NeoBundle - NeoBundle 'pianohacker/vim-textobj-indented-paragraph'
  • dein - call dein#add('pianohacker/vim-textobj-indented-paragraph')
  • vim-plug - Plug 'pianohacker/vim-textobj-indented-paragraph'

Then, add kana/vim-textobj-user the same way.

Finally, restart your editor, then install both plugins:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published