Go to Matching Brace in Visual Studio?

Viewed 191703

Is there a way in Visual Studio 2008 to go from a closing brace to its opening brace? I've found a fair amount of stuff about highlighting the brace, but nothing about moving the cursor to it.

(VB.NET version of this Question: Keyboard shortcut for Jumping between "If/End If")

27 Answers

On my Danish keyboard it's CTRL + Å.

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+] to be in line with what others say here. 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.

June 2021

On a Mac running Windows 10 under parallels for Visual Studio 2019 and c# and with US keyboard the solution which worked for me was to edit the shortcut in" Tools Options Keyboard Edit.GoToBrace

On my system that shortcut was blank...

Press the Ctl key and the ] key and save the shortcut

Related