IntelliJ IdeaVIM: jump to innermost external `{`

  1. I am using IntelliJ + IdeaVIM.

  2. Suppose the code is properly balanced.

  3. I want to travel backwards to the nearest enclosing {

{ {} { {} } | }
1 2  3 4

Here, | is the cursor. The nearest { is at 4. However, that is not an enclosing {. Instead, I want to jump to the { at 1.

Is there a simple way to do this ?

Another way to phrase this is "nearest parent {"

1 Like

I don't know whether IdeaVim properly emulates Vim's text objects, but I can accomplish this with vaB to visual select around the enclosing Block and then o to toggle between the ends of the visual selection. va{ also works (and analogously for ( and [).


I don't have IntelliJ, but in regular vim you can do this with vaBo<esc>. You could map this to a shorter command like:

:map ,, vaBo<esc>
  1. Confirming that both va{ and vaBo works in IntelliJ IdeaVIM.

  2. I tried vaaBo , vaBBo. Is there a way to "go up object hierarchy" for example:

{ { { | } } }
1 2 3

| is cursor. Right now, vaBo and vaB{ will select the level 3 { ... }. Without hitting <esc>h vaBo again, is there a way to select the level 2 { ... }, basically "go up one node in whatever virtual tree that has been constructed".

v2a{, v3a{, etc. work for me.


Not as nice as "interactive", but far better than what I currently have. Thanks!

I don’t use IdeaVIM, but in Vim you would use [{ for this.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.