521

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.

TylerH
  • 20,799
  • 66
  • 75
  • 101
resurrecteds
  • 5,176
  • 2
  • 16
  • 18
  • 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."? – Stéphane Gourichon Jan 27 '20 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". – Stéphane Gourichon Jan 27 '20 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 '20 at 22:43
  • 4
    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 '22 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 03 '23 at 13:45

23 Answers23

661

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.

wjandrea
  • 28,235
  • 9
  • 60
  • 81
JesusIniesta
  • 10,412
  • 1
  • 35
  • 28
  • 19
    CMD + Shift + \ for a mac – Jonathan Nov 25 '16 at 03: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` + `|`. –  Apr 21 '17 at 19:09
  • 24
    This works great, but what if I want to select stuff between the matching brackets? – benjaminz Sep 21 '17 at 15:13
  • @benjaminz - check out [this question](https://stackoverflow.com/questions/37835012/is-there-in-vscode-an-option-to-select-everything-between-matching-brackets). – John Y Sep 22 '17 at 16:52
  • 1
    Yeah jeez but I want it to land AFTER the brace, so I can press return and get on with business. I still have to hunt to get past the brace. – johnrubythecat Oct 01 '17 at 12:59
  • `Ctrl+K Ctrl+S`also opens Keyboard Bindings – Drenai Dec 19 '17 at 09:00
  • 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 06 '18 at 08:41
  • 1
    I don't have any shortcut configured out of the box. Moreover the useful name of the command is `editor.action.jumpToBracket`. Otherwise, it depends on the language. – Paul Pichaureau Dec 03 '18 at 07:18
  • On Linux there is no default set for the command. I've taken Ctrl+Shit+-, this was free on the DE-Keyboard – Cutton Eye Feb 21 '19 at 10:34
  • 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 '19 at 09:16
  • I would just install Vim extension and use `f)` to go to the closing bracket. I think it's faster than typing `ctrl+shift+slash`. – off99555 Jul 25 '19 at 09:35
  • 1
    in a German Visual Studio the point is called `Bearbeiten.GehezuKlammer`. I'll never understand why Microsoft decided to translate stuff like that. Best part: If you look at the german(!) documentation over [here](https://learn.microsoft.com/de-de/visualstudio/ide/default-keyboard-shortcuts-in-visual-studio?view=vs-2019) it only lists the english names of the commands. Not what they are called in german. – Steffen Winkler Dec 11 '20 at 11:09
  • 2
    @SteffenWinkler, Microsoft makes these funny decisions: Shortcuts changing with each language, emoji search (win+;) only working words in the selected input language, etc... Funniest thing is that this is certainly not making MS Engineers' lives easier – JesusIniesta Dec 11 '20 at 12:02
  • 1
    thanks @Jan go to bracket is what is missing in this answer – Chagai Friedlander Mar 24 '21 at 07:04
  • On my Danish keyboard for Windows it's apparently Ctrl + Shift + ½ – serverdude Apr 20 '21 at 06:06
  • On Icelandic keyboard it's ctrl + shift + ° – jakobinn Nov 06 '21 at 14:08
  • ctrl + shift + µ on french keyboard layout – miva2 Mar 09 '22 at 16:31
  • what about the reverse, jumping to the open bracket? – David 天宇 Wong Oct 26 '22 at 22:44
92

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 + \

jumping_monkey
  • 5,941
  • 2
  • 43
  • 58
Benjamin Pasero
  • 113,622
  • 14
  • 75
  • 54
  • 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. – resurrecteds May 07 '15 at 15:28
  • 3
    How about changing the keybinding to ```Ctrl+Enter``` or ```Shift-Enter```? – Johannes Rieken May 08 '15 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. – resurrecteds May 21 '15 at 08:09
88

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

unrealapex
  • 578
  • 9
  • 23
Ariel
  • 5,752
  • 5
  • 49
  • 59
36

The shortcut is:

Windows/English Ctrl+Shift+\

Windows/German Ctrl+Shift+^

Hexodus
  • 12,361
  • 6
  • 53
  • 72
21

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

diesel
  • 3,296
  • 1
  • 20
  • 17
  • 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. – Daniel Leiszen Jun 03 '21 at 13:17
  • This should be the accepted answer. After you use TabOut, you too will agree. – greg Aug 08 '21 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.

TylerH
  • 20,799
  • 66
  • 75
  • 101
nPcomp
  • 8,637
  • 2
  • 54
  • 49
  • 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 '21 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.

Bruno Bronosky
  • 66,273
  • 12
  • 162
  • 149
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.

thewebjackal
  • 785
  • 8
  • 17
6

Extension TabOut was the option i was looking for.

JoBaHP
  • 99
  • 1
  • 3
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" }
Neil Justice
  • 1,325
  • 2
  • 12
  • 25
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

AlDante
  • 336
  • 3
  • 8
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.

Sergio Tx
  • 3,706
  • 1
  • 16
  • 29
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.

Community
  • 1
  • 1
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.

M.Buschmann
  • 269
  • 2
  • 8
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

kann
  • 687
  • 10
  • 22
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.

kbro
  • 4,754
  • 7
  • 29
  • 40
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 }

-6

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

S.Serpooshan
  • 7,608
  • 4
  • 33
  • 61
  • 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 '17 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 '18 at 15:55
  • 11
    This shortcut is for "Visual Studio." The question is asking about "Visual Studio Code." A different product. – MetaFight Apr 17 '18 at 11:25
-9

enter image description here

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

Ivan
  • 4,383
  • 36
  • 27