Jumping from end of block to its beginning, or highlighting the block

Frequently I have the following code structure:

and I want to start editing between two of those -- but the right two! So I want to be able to match an 'end' to its beginning -- whether by jumping to the beginning, or by highlighting the block. I know that IDEA knows where blocks start and end, since I can fold them. But folding seems to be too jarring. I'd like the equivalent of Vim's "%" command instead, which jumps from an opening parenthesis or bracket to the closing. Except with code blocks. Does this feature exist? Thanks.

Navigate to Next Method Alt+Down Navigate to the next method declaration in the active editor tab.
Navigate to Previous Method Alt+Up Navigate to the previous method declaration in the active editor tab.
Navigate to Opening Brace Ctrl+Open Bracket Navigate to the start of the current code block.
Navigate to Closing Brace Ctrl+Close Bracket Navigate to the end of the current code block.

Ctrl+W will progressively select code "segments", eventually to the brace level, then method, then class: Ctrl+Shift+W will deselect.


I am using the Vim keymap on a Mac, and I've not been able to find any of these. I open Preferences, Keymap, then try searching for some keywords like "segment" or "brace", but come up emptyhanded. How can I find these actions in my keymap?


Keymap > Editor Actions > Move Caret to Code Block End/Start
Keymap > Main Menu > Navigate >previous/Next Method

As a tip, to find a (default) key mapping when a word search does not work (in this case you were unaware the key words were Code Block)  do the following:

  1. temporarily switch back to the default mapping
  2. click the "Find actions by shortcut" button to the right of the search box (To clear anything you've entered, use the clear filtering button )
  3. type the key sequence
  4. make note of the location and/or key words
  5. change back to your mapping, navigate to the action and make the change

Please sign in to leave a comment.