How do I jump to a closing bracket in Visual Studio Code?

Visual Studio-Code

Visual Studio-Code Problem Overview


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.

Visual Studio-Code Solutions


Solution 1 - Visual Studio-Code

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 do:

Ctrl+Shift+p

And select

Preferences: Open Keyboard Shortcuts

There you will be able to see all the shortcuts, and create your own. The command in question is called editor.action.jumpToBracket.

Solution 2 - Visual Studio-Code

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

Solution 3 - Visual Studio-Code

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

Solution 4 - Visual Studio-Code

The shortcut is:

Windows/English Ctrl+Shift+</kbd>

Windows/German Ctrl+Shift+^

Solution 5 - Visual Studio-Code

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

Solution 6 - Visual Studio-Code

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.

Solution 7 - Visual Studio-Code

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.

Solution 8 - Visual Studio-Code

Extension TabOut was the option i was looking for.

Solution 9 - Visual Studio-Code

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" }

Solution 10 - Visual Studio-Code

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

Solution 11 - Visual Studio-Code

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.

Solution 12 - Visual Studio-Code

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

Solution 13 - Visual Studio-Code

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

Solution 14 - Visual Studio-Code

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.

Solution 15 - Visual Studio-Code

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 > + Shift together, it will provide me desired opening closing tag of Text element.

Thanks, Nirmala

Solution 16 - Visual Studio-Code

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

Solution 17 - Visual Studio-Code

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.

Solution 18 - Visual Studio-Code

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 to me.

What I have done is:

  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 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.

Solution 19 - Visual Studio-Code

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..

Solution 20 - Visual Studio-Code

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

Solution 21 - Visual Studio-Code

enter image description here

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionresurrectedsView Question on Stackoverflow
Solution 1 - Visual Studio-CodeJesusIniestaView Answer on Stackoverflow
Solution 2 - Visual Studio-CodeArielView Answer on Stackoverflow
Solution 3 - Visual Studio-CodeBenjamin PaseroView Answer on Stackoverflow
Solution 4 - Visual Studio-CodeHexodusView Answer on Stackoverflow
Solution 5 - Visual Studio-CodedieselView Answer on Stackoverflow
Solution 6 - Visual Studio-CodenPcompView Answer on Stackoverflow
Solution 7 - Visual Studio-CodeBruno BronoskyView Answer on Stackoverflow
Solution 8 - Visual Studio-CodeJoBaHPView Answer on Stackoverflow
Solution 9 - Visual Studio-CodeNeil JusticeView Answer on Stackoverflow
Solution 10 - Visual Studio-CodeAlDanteView Answer on Stackoverflow
Solution 11 - Visual Studio-CodeSergio TxView Answer on Stackoverflow
Solution 12 - Visual Studio-CodeClément DelebecqueView Answer on Stackoverflow
Solution 13 - Visual Studio-CodeM.BuschmannView Answer on Stackoverflow
Solution 14 - Visual Studio-CodeKaran YadavView Answer on Stackoverflow
Solution 15 - Visual Studio-CodeNirmala MauryaView Answer on Stackoverflow
Solution 16 - Visual Studio-CodekannView Answer on Stackoverflow
Solution 17 - Visual Studio-CodekbroView Answer on Stackoverflow
Solution 18 - Visual Studio-CodethewebjackalView Answer on Stackoverflow
Solution 19 - Visual Studio-CodeHackerGpratView Answer on Stackoverflow
Solution 20 - Visual Studio-CodeJaffreena Michael ThomasView Answer on Stackoverflow
Solution 21 - Visual Studio-CodeIvanView Answer on Stackoverflow