40
votes

Is there any keyboard shortcut to navigate from one parenthesis ( to the matching one ) in IntelliJ?

Or even to "jump to the next opening/closing parenthesis (/) from wherever my cursor is"?

And, if there's no way to do it 'natively', are there any plugins that could add this functionality quickly and easily?

EDIT: the best solution I've found is added as a comment in liango's answer below, namely to put the cursor on the first or last brace and then press CTRL-W twice. Not ideal, but it does the job!

5
There is no built in functionality for that, AFAIK. But you could try AceJump and emacsIDEAs plugins. What they offer is not "direct" jump .. but some advanced stuff .. which may not be suitable for you (too "advanced" -- with AceJump it's like "Ctrl+;" then ")" and then what ")" you want to jump to -- 3 keys in total).LazyOne
Thanks for this - I'll give AceJump a whirl and see how it goes. If anybody else has any suggestions for alternatives please do share.caponica
please also vote for IDEA-12068lena

5 Answers

40
votes
  • You can use Ctrl + [ and Ctrl + ] to navigate to a code block's start and end.

  • You can also use Ctrl + Shift + M to navigate between the start and end of a code block.

On Mac, you can use Option + Cmd +[ and Option + Cmd + ], and Ctrl + M


Source: https://www.jetbrains.com/help/idea/2016.2/navigating-to-braces.html

30
votes

use CTRL-W to expand the selection within a bracket, use repeatedly if needed to select further out, then use the arrows.

30
votes

CTRLSHIFTM is the Windows/Linux default shortcut for action "Move caret to matched brace". (For other environments see here and use the Shortcuts dropdown in the top right of the page.)

Or if desired, the shortcut keys can be changed as follows: Go to Settings -> Keymap -> Editor Actions, or just type the name in the search box.

4
votes

Here's the latest and greatest as of version 2020.1

To move caret between matching code block braces, press Ctrl+Shift+M.

To navigate between code blocks, press Ctrl+Shift+[ or Ctrl+Shift+].

From the documentation

Navigate with the caret

To navigate backwards, press Ctrl+Alt+← Left. To navigate forward, press Ctrl+Alt+→→ Right.

To navigate to the last edited location, press Ctrl+Shift+Backspace.

To find the current caret location in the editor, press Ctrl+M. This action might be helpful if you do not want to scroll through a large file.

However, you can press the Up and Down arrow keys to achieve the same result.

To highlight a word at the caret you are trying to locate, select Edit | Find | Next Occurrence of the Word at Caret from the main menu.

To see on what element the caret is currently positioned, press Alt+Q.

To move caret between matching code block braces, press Ctrl+Shift+M.

To navigate between code blocks, press Ctrl+Shift+[ or Ctrl+Shift+].

To move the caret forward to the next paragraph or backward to the previous one, press Ctrl+Shift+A and search for the Move Caret Forward a Paragraph or Move Caret Backward a Paragraph action.

You can also select a text and then move the caret forward or backward to a paragraph. Press Ctrl+Shift+[ and search for the Move Caret Forward a Paragraph with Selection or Move Caret Backward a Paragraph with Selection action.

-1
votes

You can use Ctrl-[ and Ctrl-].