Provides text objects and movements for indented paragraphs.
Text objects:
ir
- current paragraph, indented same or more than current linear
- same as above, including surrounding empty lines
Movements:
g)
- move to the next beginning of an indented paragraphg(
- move to the previous beginning of an indented paragraph
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();
}
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();
}
- NeoVim or Vim 7.3+
- vim-textobj-user
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: