523

In VSCode when I type a bracket, e.g '(', it automatically creates the ending bracket: ')'. Are there any shortcuts to jump to the closing bracket or parenthesis, without pressing the 'End' key?

I found a way to do in Sublime Text 2 that did exactly that, using a Regex in the User's Key Bindings, but couldn't find a way to do it in VSCode.

5
  • 1
    Is this question really asking for a key shortcut as offered by answers, given that the OP wrote "Pressing Ctrl+Shift+] is even more complex than pressing the 'End' key."? Jan 27, 2020 at 15:25
  • 1
    On my Linux installation, there was no preassigned key shortcut. But you can create one in "File->Preference->Keyboard shortcuts" and using he search bar to filter to "go to bracket". Jan 27, 2020 at 15:26
  • @StéphaneGourichon it may seem like illogical but using these complex shortcuts enables you to keep your finger on the keyboard home row thus overall faster typing speed.
    – EmreAkkoc
    Apr 16, 2020 at 22:43
  • 5
    200k views and 400+ upvotes. Whole developer community spending time looking for these simple things. Ctrl+[ was common convention and was easy and intuitional too. Now they changed it to `Ctrl+Shift+\`. Not sure who are people behind these decisions and why do they do it!
    – Atul
    Sep 18, 2022 at 11:15
  • What was the problem with Ctrl+] anyway? Good thing it is configurable. It was set to indent for some reason.
    – Rudy
    Apr 3 at 13:45

23 Answers 23

663

Mac Cmd+Shift+\

  • Mac with french keyboard : Ctrl+Cmd+Option+Shift+L

Windows Ctrl+Shift+\

  • Windows with spanish keyboard Ctrl+Shift+|

  • Windows with german keyboard Ctrl+Shift+^

Ubuntu Ctrl+Shift+\


Alternatively, you can go to Keyboard Shortcuts (Ctrl+Shift+p and select Preferences: Open Keyboard Shortcuts), and there you will be able to see all the shortcuts and create your own. The command in question is called editor.action.jumpToBracket.

17
  • 19
    CMD + Shift + \ for a mac
    – Jonathan
    Nov 25, 2016 at 3:54
  • 9
    My keyboard is Spanish - LatinAmerica so I can't press \ alone, to get it I have to press AltGr+'. Key | works so the command in my keyboard is Ctrl + Shift + |.
    – user2188550
    Apr 21, 2017 at 19:09
  • 24
    This works great, but what if I want to select stuff between the matching brackets?
    – benjaminz
    Sep 21, 2017 at 15:13
  • 5
    On French keyboard, that's Ctrl+Shift+* and it must be the * on the regular keyboard, not the numeric one. Searching (with Ctrl+Shift+P) the Go to Bracket command indeed reveals that. And the Select to Bracket command, which has no shortcut by default, but as explained, it can be added via custom keyboard binding.
    – PhiLho
    Jul 6, 2018 at 8:41
  • 6
    The command depends on the keyboard layout! On German keyboards, the shortcut is Strg + Shift + ^. To find out the keyboard shortcut, press Ctrl + Shift + P and type in "go to bracket".
    – Jan
    Jul 18, 2019 at 9:16
93

You can learn commands from the command palette (Ctrl/Cmd + Shift + P). Look for "Go to Bracket". The keybinding is also shown there, which is

Windows:
Ctrl + Shift + \

3
  • 3
    Thanks for you reply but that's not what I was looking for. Pressing Ctrl+Shift+] is even more complex than pressing the 'End' key. I am looking for a way to go to the closing bracket using the 'Enter' key, for instance, just like you can do in Eclipse. Changing the 'enter' key in the Keybindings.json file to jumpToBracket does not override the default behavior of creating a new line. May 7, 2015 at 15:28
  • 3
    How about changing the keybinding to Ctrl+Enter or Shift-Enter? May 8, 2015 at 13:28
  • Eventually I changed the binding of the 'Ctrl+`' key to have the same functionality as the 'End' key. For now, did not find a solution to have the same behavior of Eclipse. May 21, 2015 at 8:09
88

The out-of-the-box way to do it is Ctrl + Shift + |

5
  • 9
    This is only an out-of-the-box way to express that key combo. It's the same keys as given in the current top answer.
    – John Y
    Sep 22, 2017 at 16:48
  • 4
    This answer was the default on my linux vscode installation Apr 16, 2018 at 22:02
  • 9
    Technically it is `Ctrl + Shift + \` for a US keyboard Aug 10, 2018 at 2:17
  • I rather type the closing bracket than doing this combination.
    – IamDOM
    Jul 12, 2021 at 14:40
  • 2
    For Turkish keyboards it is CTRL-SHIFT-ç
    – endo64
    Dec 8, 2021 at 13:10
36

The shortcut is:

Windows/English Ctrl+Shift+\

Windows/German Ctrl+Shift+^

1
  • In Visual Studio 2019 Windows\German I found this: [Cntrl] + [´] to work
    – Mong Zhu
    Sep 18, 2019 at 16:44
22

For this, I installed an extension called TabOut. Pretty much does what the name suggests.

2
  • 1
    This should be the correct answer, since this is the most effective way of doing this. At least for me, using the End or mouse needs moving my right hand out of the keyboard. Ctrl + sg is not better than closing the bracket (Shift + 0). So the tab is the best way to do it. Jun 3, 2021 at 13:17
  • This should be the accepted answer. After you use TabOut, you too will agree.
    – greg
    Aug 8, 2021 at 13:50
18

Press Ctrl+K+S

or

Open up File --> Preferences ---> Keyboard Shortcuts

Here, type editor.action.jumpToBracket will show you what is the current setting. You can keep it as is or change it to your combination.

1
  • Using Ctrl+Shift+p and selecting Help: Keyboard Shortcuts Reference it takes you to a "default" shortcuts webpage, and the shortcut here wasn't working in my case (spanish keyboard). After opening Keyboard Shortcuts window (Ctrl+K+S) I've seen it was blank (I guess default value) and I've set my own combination.
    – EAmez
    Apr 16, 2021 at 14:05
11

Details that can benefit everyone (Linux/Win/Mac)

The command in the keyboard shortcuts menu/editor is editor.action.jumpToBracket there you can set it to whatever you like. There is also one called editor.action.selectToBracket which has no shortcut by default (at least on Mac).

Etc.

On the Mac editor.action.jumpToBracket starts out as Cmd+Shift+\ and I changed it to Ctrl+] because I didn't want a Shift in there and to be in line with what others here say works on Linux/Win. I did so in the hopes that I could use Ctrl+Shift+] to "Extend selection to matching bracket". That is what lead me to discover the details above. I set editor.action.selectToBracket to Ctrl+Shift+] and got exactly the behavior I wanted.

10

There are multiple right answers for achieveing what was required. Here are my two cents anyway.

The operation to quickly jump to the opening or the closing bracket has to be instant. The Ctrl + Shift + \ is pretty verbose if you ask me.

Here's my way of setting it up:

  1. Click on the enter image description here icon and select Keyboard shortcuts.
  2. In the top right corner, click on enter image description here
  3. In the settings.json file that opens up, add the following object in the array:
[
...,
{
  "key": "shift shift",
  "command": "editor.action.jumpToBracket",
  "when": "editorTextFocus"
}
, ...
]
  1. Save the file.

With this, you should be able to quickly jump to the opening or closing bracket with Shift Shift.

6

Extension TabOut was the option i was looking for.

1
  • Duplicate answer
    – piegames
    Feb 1, 2022 at 23:12
4

Command "editor.action.jumpToBracket" jumps between opening and closing brackets.

Here is the command's default key binding as seen in window Default Keyboard Shortcuts accessed from File | Preferences | Keyboard Shortcuts:

{ "key": "ctrl+shift+\\", "command": "editor.action.jumpToBracket",
                             "when": "editorTextFocus" }

If you're fond of quickly configuring keyboard shortcuts and VS Code settings, there are commands "workbench.action.openGlobalKeybindings" and "workbench.action.openGlobalSettings":

~/.config/Code/User/keybindings.json:

{ "key": "ctrl+numpad4", "command": "workbench.action.openGlobalKeybindings" }
{ "key": "ctrl+numpad1", "command": "workbench.action.openGlobalSettings" }
3

On French keyboard the default binding is : Ctrl+Shift+*

2

For those with a non-US keyboard:

File > Preferences > Keyboard Shortcuts. 
(Code > Preferences > Keyboard Shortcuts on Mac)

shows the current key bindings. See also here: https://code.visualstudio.com/docs/getstarted/keybindings

2

In Spanish keyboard it's Ctrl+Shift+º

It seems to change from one keyboard layout to another, so better look for it with Cmd+Shift+P and type "go to bracket" as others suggested.

2

The 'go to bracket' shortcut takes cursor before the bracket, unlike the 'end' key which takes after the bracket. WASDMap VSCode extension is very helpful for navigating and selecting text using WASD keys.

1

In Portuguese / Windows keyboard (POR/PTB2) i had to press:

Ctrl + Shift + }
0

In german VS-Environments(here 2015): Optionen/Umgebung/Tastatur. (english: options/environment/keyboard). Show Commands With "GeheZuKlammer" (english: "GoToBracket"). Set your own Shortcut.

0
0

Simply adding opening tag and writing element name and while adding closing tag with pressing shift button keyword will do the job.

For example, If i need to write <Text></Text>

I will write, <Text and will press > + Shifttogether, it will provide me desired opening closing tag of Text element.

Thanks, Nirmala

0

i use End key, but. as you said you found a way to solve this problem in sublime text... right????

i will suggest you to install keymap of sublime text .. here and use that sortcut key to solve your same problem in vscode.

how to install
press -> ctrl + k then ctrl + M

or watch the bottom left corner there is a gear called setting click on theat you will found keymaps you will redirected to the extentions were you will have to choose your ex-editor..

0

May be it helps someone looking for shortcuts in which they are comfortable and wanted to use in VS Code. I use Sublime Text shortcuts in VS Code through this extension.

enter image description here

0

My MacBook has Go To Bracket as Shift-Cmd-\ but my Win10 laptop (UK keyboard) has it on Ctrl-Shift-`.

If you click on Go in the menu bar then Go To Bracket is in that list and you should see the keyboard shortcut listed against it.

0

Ctrl+End is doing the task only for CSS.

lets say,

.class{ p(you to jump from here to the end of this CSS property. In vs code simply hit ctrl+End }

1
  • Can you elaborate? - Why is this the case, and where can it be configured? Feb 21 at 22:17
-6

Please use Control + ] by placing your cursor on start or end

3
  • 8
    This doesn't work, at least using the standard keybindings. What you've shown here normally increases the indent level.
    – John Y
    Sep 22, 2017 at 16:51
  • @S.Serp, I'm on CentOS using "yum install code" version of vscode (help about says 1.19.1) and this doesn't work work. I get the same behavior as John Y, it increases the indent level. For me, Ctrl+Shift+\ jumps to the matching parenthesis, again it jumps back to where I was.
    – PatS
    Mar 30, 2018 at 15:55
  • 11
    This shortcut is for "Visual Studio." The question is asking about "Visual Studio Code." A different product.
    – MetaFight
    Apr 17, 2018 at 11:25
-9

enter image description here

(For anybody looking how to do it in Visual Studio!)

1
  • 16
    and Visual Studio shortcut is different from Visual Studio Code! Feb 6, 2019 at 1:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.