Reputation: 5996
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.
Upvotes: 602
Views: 321768
Reputation: 124234
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 + \
Upvotes: 111
Reputation: 43
In Portuguese / Windows keyboard (POR/PTB2) i had to press:
Ctrl + Shift + }
Upvotes: 1
Reputation: 21
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 }
Upvotes: 0
Reputation: 12519
Mac Cmd+Shift+\
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
.
Upvotes: 767
Reputation: 869
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:
[
...,
{
"key": "shift shift",
"command": "editor.action.jumpToBracket",
"when": "editorTextFocus"
}
, ...
]
With this, you should be able to quickly jump to the opening or closing bracket with Shift Shift.
Upvotes: 12
Reputation: 4991
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.
Upvotes: 0
Reputation: 747
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.
Upvotes: 0
Reputation: 95
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..
Upvotes: 0
Reputation: 3386
For this, I installed an extension called TabOut. Pretty much does what the name suggests.
Upvotes: 24
Reputation: 91
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
Upvotes: 0
Reputation: 21
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.
Upvotes: 2
Reputation: 31
On French keyboard the default binding is : Ctrl+Shift+*
Upvotes: 3
Reputation: 9973
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.
Upvotes: 18
Reputation: 70479
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).
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.
Upvotes: 12
Reputation: 12965
The shortcut is:
Windows/English Ctrl+Shift+\
Windows/German Ctrl+Shift+^
Upvotes: 38
Reputation: 98
Please use Control + ] by placing your cursor on start or end
Upvotes: -6
Reputation: 3868
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.
Upvotes: 2
Reputation: 358
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
Upvotes: 2
Reputation: 1405
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" }
Upvotes: 4
Reputation: 263
In german VS-Environments(here 2015): Optionen/Umgebung/Tastatur. (english: options/environment/keyboard). Show Commands With "GeheZuKlammer" (english: "GoToBracket"). Set your own Shortcut.
Upvotes: 0