Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete matching brackets in VS Code?

Tags:

I know you can jump between matching brackets with Ctrl + Shift + \. I would like to place the cursor right after a bracket and delete both that bracket and its matching one as easily as possible.

Since with Alt + Click you can have multiple selections, I was looking for something similar to: Ctrl + Shift + Alt + \ for placing another cursor on the matching bracket and then deleting both with a single backspace.

Is there any shortcut deleting a pair of matching brackets/parenthesis?

like image 844
Guimo Avatar asked Jan 10 '17 13:01

Guimo


People also ask

How do I get out of bracket in Vscode?

As in, when you press "tab" key near a closing bracket, the cursor will jump over it instead of adding a new tab.

How do I enable bracket colors in Vscode?

The feature can be enabled by adding the setting "editor. bracketPairColorization. enabled": true .


1 Answers

There is an extension called "Bracketeer" that does what you want.

First, install with

Ctrl-p, then ext install pustelto.bracketeer, followed by an enter.

You can then add the following to your keybindings.json

  {
    "key": "ctrl+alt+backspace",
    "command": "bracketeer.removeBrackets"
  },

You can then use ctrl-alt-backspace to remove matching brackets.

See also:

  • https://marketplace.visualstudio.com/items?itemName=pustelto.bracketeer
like image 102
Synthetica Avatar answered Sep 16 '22 15:09

Synthetica