You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS Code中括号外侧跳转无快捷键的问题解决方法咨询

Fix: Bind a Shortcut for "Select to Bracket Outside" in VS Code

Got it, let's get this sorted out! Here's how you can easily assign a keyboard shortcut to the "Select to Bracket Outside" function that's currently only in the command panel:

Step 1: Open Keyboard Shortcuts Settings

On Mac, you can use the shortcut Cmd + K followed by Cmd + S to jump straight to the keyboard shortcuts panel. Alternatively, go through the menu bar: Code > Preferences > Keyboard Shortcuts.

Step 2: Find the Target Command

In the search bar at the top of the shortcuts panel, type editor.action.selectToBracketOutside (this is the internal command name for "Select to Bracket Outside"). You should see the function pop up in the list.

Step 3: Assign Your Preferred Shortcut

Click the small pencil icon next to the command, then press the key combination you want to use. For example, Cmd + Opt + Shift + \ is a good choice since it's similar to the existing "jump to outer bracket" shortcut (Cmd + Shift + \) and less likely to conflict with other defaults.

If VS Code warns about a shortcut conflict, you can either pick a different combination or choose to override the conflicting shortcut (just make sure you don't need the original one!).

Alternative: Edit the JSON Configuration Directly

If you prefer working with raw settings, open the Command Palette (Cmd + Shift + P), search for Open Keyboard Shortcuts (JSON), and add this entry to the file:

{
  "key": "cmd+opt+shift+\\",
  "command": "editor.action.selectToBracketOutside",
  "when": "editorTextFocus && editorLangId != 'markdown'"
}

The when clause ensures the shortcut only works when you're focused on a code editor (not markdown, where brackets might behave differently).

Test It Out

Head back to your code snippet report_disk_space() { return }, place your cursor inside the curly braces or parentheses, and hit your new shortcut—it should instantly select the content up to the outer edge of the bracket!

内容的提问来源于stack exchange,提问作者Wizard

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 07:56:31