Keystroke to go to matching brace?

I know about the go to matching code block start|end; what I'm after is the
magic keystroke that will allow me to go to the matching brace position,
regardless of the brace (and therefore scope) type, so I would like to be able
to go between () [] {}, hopefully with selection.
The current behaviour insists on code blocks so I cannot select expressions for example.

Anyone knows what the action is called (it must be there since the matching brace is already highlighted automatically...)?

Cheers,

Bonny

19 comments

control + []
Bonny Rais wrote:

I know about the go to matching code block start|end; what I'm after is the
magic keystroke that will allow me to go to the matching brace position,
regardless of the brace (and therefore scope) type, so I would like to be able
to go between () [] {}, hopefully with selection.
The current behaviour insists on code blocks so I cannot select expressions for example.

Anyone knows what the action is called (it must be there since the matching brace is already highlighted automatically...)?

Cheers,

Bonny



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

control + []


Does not work on a German keyboard...

0

control + {} ?

Tom wrote:
>> control + []


Does not work on a German keyboard...



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Same problem, {[]]} are all only reachable with AltGr and this combination is not usable as a shortcut :(
I use () to move without selection and stopped using bookmarks 8 and 9.

CU

Ralf

0

Hi!

Same problem, {[]]} are all only reachable with AltGr and this combination is not usable as a shortcut :(
I use () to move without selection and stopped using bookmarks 8 and 9.


I mapped them to Ctrl-AltGr-8 and Ctrl-AltGr-9, didn't use the "move
with selection" feature.

Ciao,
Mario

0

Maxim Mossienko (JetBrains) wrote:

control + []


That's for moving to the start/end of the current code block, which...

Bonny Rais wrote:

>> I know about the go to matching code block start|end;

...Bonny knows about.

>> what I'm after
>> is the magic keystroke that will allow me to go to the matching brace
>> position, regardless of the brace (and therefore scope) type, so I
>> would like to be able
>> to go between () [] {}, hopefully with selection. The current
>> behaviour insists on code blocks so I cannot select expressions for
>> example.

You can almost get what you want with a combination of the Lysosome
plug-in and judicious use of ctrl+w, but I think specific support in
IDEA would be very welcome. I think it could work as follows: if a
matching pair of parentheses, braces or brackets is highlighted (because
of the caret position) then some keystroke should move the caret to the
other position that causes the matching pair to continue to be highlighted.

Maybe file a JIRA request?

--
Mark Scott
mark@codebrewer.com

0

I mapped them to Ctrl-AltGr-8 and Ctrl-AltGr-9


Still not easily to handle for a single hand, isn't it?

0

T> Still not easily to handle for a single hand, isn't it?

The point is that you can map the actions to whatever keyboard shortcut you
want.


0

My point is, that IMHO there should be default short-cuts which work on
every keyboard. This should be possible to restrict to modifier combinations
with letters (A...Z), digits (1...0), function keys (F1...F10/F12), space,
tab, cursor keys, ins, del, home, end, page up/down, number pad. Special
characters (<>,.-;:_#'+*!"§$%&/()=?{[]}\|) which might not be reachable
without another modifier, should be avoided.

0

Are you aware of how many keyboard layouts exist? E.g. the digits (1..0)
are only reachable with shift on a French keyboard, and home/end are
only reachable with the function modifier on some notebook keyboards. So
restricting shortcuts to the common set of every keyboard would leave
you with very few possibilities.

Tom wrote:

My point is, that IMHO there should be default short-cuts which work on
every keyboard. This should be possible to restrict to modifier
combinations with letters (A...Z), digits (1...0), function keys
(F1...F10/F12), space, tab, cursor keys, ins, del, home, end, page
up/down, number pad. Special characters (<>,.-;:_#'+*!"§$%&/()=?{[]}\|)
which might not be reachable without another modifier, should be avoided.

0

restricting shortcuts to the common set of every
keyboard would leave
you with very few possibilities.


Which is why I would propose to go through a thorough revision of all keyboard shortcuts and make much more use of double stroke shortcuts.

My suggestion would be to keep only a small number of really often used shortcuts (e.g. like CTRL-W) and re-assign everything else in a more consistent manner (as far as the use of function and modifier keys is concerned).

JB could then support (at least for a transition period) both shortcut layouts (much like the "classic" vs. "modern layout" support for the IDE settings a few years back). Also, the "reformed" shortcut layout could impose restrictions on the allowed keys and possibly force plugin action shortcuts to use double strokes (or at least discourage users from overriding this).

Maybe a reform like this would make it easier for new users to remember shortcuts. What are your thoughts on this?

Regards,
Jens

0

Hi Martin,

Are you aware of how many keyboard layouts exist?


Well, I just can guess.

> E.g. the digits (1..0) are only reachable with shift on a French keyboard

Really? I did not expect that.

Tom

0

On 2007-03-21 14:34:59 +0300, Jens Voss <no_reply@jetbrains.com> said:

>> restricting shortcuts to the common set of every
>> keyboard would leave
>> you with very few possibilities.


Which is why I would propose to go through a thorough revision of all
keyboard shortcuts and make much more use of double stroke shortcuts.

My suggestion would be to keep only a small number of really often used
shortcuts (e.g. like CTRL-W) and re-assign everything else in a more
consistent manner (as far as the use of function and modifier keys is
concerned).

JB could then support (at least for a transition period) both shortcut
layouts (much like the "classic" vs. "modern layout" support for the
IDE settings a few years back). Also, the "reformed" shortcut layout
could impose restrictions on the allowed keys and possibly force plugin
action shortcuts to use double strokes (or at least discourage users
from overriding this).

Maybe a reform like this would make it easier for new users to remember
shortcuts. What are your thoughts on this?

Regards,
Jens


Not everyone likes double strokes. Personally, I hate em.

0

On 2007-03-21 10:03:16 +0300, Tom <noname@jetbrains.com> said:

My point is, that IMHO there should be default short-cuts which work on
every keyboard. This should be possible to restrict to modifier
combinations with letters (A...Z), digits (1...0), function keys
(F1...F10/F12), space, tab, cursor keys, ins, del, home, end, page
up/down, number pad. Special characters (<>,.-;:_#'+*!"§$%&/()=?{[]}\|)
which might not be reachable without another modifier, should be
avoided.


Ins key is missing on Mac.

0

On 2007-03-21 10:03:16 +0300, Tom <noname@jetbrains.com> said:

My point is, that IMHO there should be default short-cuts which work on
every keyboard. This should be possible to restrict to modifier
combinations with letters (A...Z), digits (1...0), function keys
(F1...F10/F12), space, tab, cursor keys, ins, del, home, end, page
up/down, number pad. Special characters (<>,.-;:_#'+*!"§$%&/()=?{[]}\|)
which might not be reachable without another modifier, should be
avoided.


And many Fxx keys and their combinations bound to various operating
system level shortcuts on Mac.
How about that?

0

Ins key is missing on Mac.


But there is a Help key on this position - at least on my keyboard. And
detecting a Mac OS is much easier than detecting different keyboards.

0

And many Fxx keys and their combinations bound to various operating
system level shortcuts on Mac.


Or on KDE.

How about that?


I've deactivated the OS shortcuts where possible.

0

It is funny, as German keyboards have square and curly braces under special keys and shortcuts which uses them does not work.

The one which works is "Ctrl + Shift + m".

2

Please sign in to leave a comment.