用于匹配大括号的 IntelliJ IDEA 快捷键映射

发布于 2024-10-06 10:22:05 字数 149 浏览 10 评论 0原文

在 IntelliJ IDEA 中导航到匹配大括号的键盘映射是什么?

public void blah() {|
   ...

}

如果 | 是我的光标,我想使用此键盘映射跳转到右大括号。

What is the keymap for navigating to the matching brace in IntelliJ IDEA?

public void blah() {|
   ...

}

If | is my cursor, I would like to jump to the closing brace with this keymap.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

峩卟喜欢 2024-10-13 10:22:05

我只用 IntelliJ 9 验证了这一点,但是:

在 Windows 上:

  • Ctrl+} 将移至结束位置
    括号。

  • Ctrl+{ 将移动到左括号。

在 Mac 上:

  • 使用 cmd 而不是 Ctrl

I've only verified this with IntelliJ 9 but:

On Windows:

  • Ctrl+} will move to the close
    bracket.

  • Ctrl+{ will move to the open bracket.

On Mac:

  • Use cmd instead of Ctrl.
有深☉意 2024-10-13 10:22:05

作为 Ctrl+}Ctrl+{ 的替代方案,您可以默认使用 Ctrl+Alt+Shift+9Ctrl+Alt+Shift+8 分别。我什至还没有试图记住这一点。 ;)

也在设置-> (IDE 设置 ->) 键盘映射 ->编辑器操作中有一个名为“将插入符移动到匹配的大括号”的条目,它没有默认的键映射。我将其映射到 Ctrl+< 因为组合键未映射,并且德语键盘上的按键彼此靠近。

这适用于 IDEA 12。

As an alternative to Ctrl+} and Ctrl+{ you can by default use Ctrl+Alt+Shift+9 and Ctrl+Alt+Shift+8 respectively. I haven't even tried to remember that yet. ;)

Also in Settings -> (IDE Settings ->) Keymap -> Editor Actions there's an entry called "Move Caret to Matched Brace" that doesn't have a default key mapping. I mapped it to Ctrl+< because the key combination was unmapped and the keys are close to each other on a german keyboard.

This applies to IDEA 12.

寂寞花火° 2024-10-13 10:22:05

它在我的 Mac 上使用 IDEA v15 并保留 MacOSX 10.5+ 的默认键盘映射 ^M (control + M)

如果您不确定,请转到首选项并搜索“将插入符移动到匹配大括号”。这是命令的名称,您可以设置自己的快捷方式!

Its ^M (control + M) on my Mac using IDEA v15 and keeping the default keymap for MacOSX 10.5+

If you are not sure go to prefs and search for "Move Caret to Matching Brace". That's the name of the command and you can set your own shortcut!

看春风乍起 2024-10-13 10:22:05

在某些键盘(包括瑞典语键盘)上,使用 Ctrl-} 或 Ctrl-{ 并不实用。在这种情况下,我发现的最佳方法是双击视图中的括号,这会突出显示括号之间的所有内容,然后使用左箭头或右箭头移动到突出显示区域的适当末端。

On some keyboards, including Swedish ones, it's not practical to use Ctrl-} or Ctrl-{. The best approach I've found under those circumstances is to double-click the bracket in view, which highlights everything between the brackets, then use left-arrow or right-arrow to move to the appropriate end of the highlighted region.

鸵鸟症 2024-10-13 10:22:05

Ctrl+}Ctrl+{ 仅将光标移动到包含 ( 及其对应项的闭括号)您调用快捷方式的地方。

Ctrl+Shift+}Ctrl+Shift+{< /kbd> 将光标移动到与第一个提到的快捷方式相同的大括号,并突出显示起点和结果大括号之间的所有区域。

Ctrl+Shift+M 将光标移动到相反或最近的任何类型的大括号或方括号 ( )、{ }、 >、[]。

最后一项可以在设置中更改。

Ctrl+} and Ctrl+{ only moves the cursor to the closes corresponding brace that embraces ( with its counterpart) the place where you called the shortcut.

Ctrl+Shift+} and Ctrl+Shift+{ moves the cursor to the same brace as the first mentioned shortcut and highlights all the area between start point and the result brace.

Ctrl+Shift+M moves the cursor to the opposite or nearest embracing brace or bracket of any sort ( ), { }, < >, [ ].

The last one can be changed in the settings.

空宴 2024-10-13 10:22:05

@dhable 也是对的,但你也可以做这个鼠标

将光标放在大括号中并双击,这样就会选择或
突出显示代码 bw 大括号

在此处输入图像描述

@dhable is also right but you can also do this mouse

place the cursor with braces and double click so this will select or
highlight the code bw braces

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文