How to jump to matching braces?

Couldn't manage to find any shortcuts in Keymap predefined for finding matching braces. Any ideas?

18 comments
Comment actions Permalink

no !

He wanted ^M 

^M -> move Caret to matching brace.

18
Comment actions Permalink

Hi Egor,

These shortcuts should do the job:
Ctrl+[
Ctrl+]

13
Comment actions Permalink

CTRL + SHIFT + M

5
Comment actions Permalink

Ctrl+[ looked promising but failed to find matching square-bracket for me on Windows 10, IntelliJ 2017.1.  Possibly intended for curlys

^M might be a Mac key-map(?).

I found Ctrl+W useful to (increasingly) select the block where caret was found, then right or left arrow to place caret at beginning/end of block. 

3
Comment actions Permalink

It is called "Move Caret to Code Block Start/End".

File | Settings | Keymap. Click on the Filter/Funnel icon (the one next to the Bin icon) -- now you can search for an action by its shortcut.

1
Comment actions Permalink

I am on mac and can confirm that ^M did it for me! What a relief, since none of the mappings using [ worked

1
Comment actions Permalink

Can someone explain the difference between these two settings?

No difference. Just different nodes: one that contains editor actions and another one when the action is present in the Main Menu.

 

1
Comment actions Permalink
  1. Not all actions (be it Editor Actions or some another) are available via Main Menu. E.g. some plugins have a few actions but have only 1 or 2 of them listed in the menu.
  2. Everyone customizes editing shortcuts at some point to better suit their needs/habits. Having them all under one easy to spot node helps locating them.
1
Comment actions Permalink

It works! Thank you, Andriy!
How this shortcut named in Keymap BTW?

0
Comment actions Permalink

Found! Thanks again, Andriy!

0
Comment actions Permalink

Ctrl+[ and Ctrl+] worked for me in resolving the dreaded

     "Missing }" error

at the very bottom of a 9000-line source file. Here are the steps I followed:

1. Click on the last close-curly brace in the file.

2. Type Ctrl-[ to find it's twin.

3. Is that open-curly brace is correct? If so move up to the nearest close-curly-brace.

4. Repeat until you find an improperly matched pair.

In my case I found the function that was missing a close-curly-brace in an if-clause. 

Thanks @AndriyBazanov!

0
Comment actions Permalink

This seems to be a little off for Rider for Mac.

If you are at the end brace, cursor is before or after the '}', the Command + '[' works but will take you to the function name, overshooting the '{' by one line.

But putting the cursor before or after the beginning brace, '{', and then typing Command + '[' or ']' doesn't seem to really work.

0
Comment actions Permalink

In Rider only Ctrl+[ works.

Does not jump back on Ctrl+]

0
Comment actions Permalink

that's a bug...why only jump one way?

0
Comment actions Permalink

@David Brown, @Jay Freyensee

It works just fine in PHP, JS and HTML code for me (at least those cases that I use on daily basis).

You must check (report that via ticket on YouTrack) for your IDE as such functionality is language specific and there may be some nuances (and even bugs) for specific cases (e.g. in PhpStorm some time ago it worked in HTML .. but some bits did not worked when it was a mix of HTML with PHP code in it).

Reporting bugs in PhpStorm thread does not make much sense and can easily be unnoticed by devs.

0
Comment actions Permalink

Can someone explain the difference between these two settings?

0
Comment actions Permalink

OK thanks. I did notice later that editing one also edited the other. I suppose by "nodes" you mean "contexts" (nodes seems to be a more JetBrains-developer-friendly term, whereas context I think is more user-perspective-friendly), though I'm not sure why they're specified there in two different contexts... is 'Editor Actions' kind of redundant to 'Main Menu > Navigate > Navigate in File'? I'm a little unclear on why two contexts/nodes show there when only one is needed.

0
Comment actions Permalink

Its also nice to know that you can select increasing or decreasing sections of code near the cursor with ⌥ and Up or Down arrows (MacOS) and Ctrl+W or Ctrl+Shift+W (Windows/Linux). When extending the selection, IntelliJ IDEA automatically selects the next valid expression in increasing sections. It makes it easy to find matching braces.

0

Please sign in to leave a comment.