Search code examples
vimvi

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


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!


Solution

  • 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 point and then redo the initial selection.