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!

有帮助吗?

解决方案 2

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

其他提示

  • 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

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.

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.

You can use Ctrl-[ and Ctrl-].

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top