Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select progressively "inner" and/or "outer" code blocks in vim

Tags:

vim

vi

I can use vim commands like va} or vi] to automatically select everything within parentheses, brackets, etc.

Once I have such a selection, is there a way to then select the next outermost selection of that type? (Then from there, back to the next "innermost"?)

I am 99.9% sure I used to know how to do this - but can't find it or figure it out anywhere!

like image 405
Brad Avatar asked Dec 11 '12 19:12

Brad


1 Answers

Just repeat the object selection keys. For your examples this would be va}a} or vi]i].

I don't think that there is a way to then reduce the selection back to an inner block. Other than to use Esc to clear the selection, `` to jump back to your starting poing and then redo the initial selection.

like image 111
qqx Avatar answered Oct 06 '22 12:10

qqx