TheDoc
TheDoc

Reputation: 718

Sublime Text Editor snippet to remove parentheses

Sublime is able to add parentheses, brackets (curly and square), apostrophes, and quotes to highlighted text by default. I've tried but can't seem to find a way to have it remove those as well. What I'd like to be able to do is highlight some text that is surrounded by parentheses and have it remove those. Is there a good way to do that using snippets?

I suspect it can be done with use of allFollowingCharacter and allPrecedingCharacter but it seems those might be from a previous version of Sublime when those were in XML instead of the current JSON...?

Any help would be appreciated!

Upvotes: 5

Views: 3068

Answers (2)

ForgetfulFellow
ForgetfulFellow

Reputation: 2632

I'm surprised this question isn't searched more regularly!

BracketHighlighter is an excellent utility that includes convenient deleting of parenthesis. To cut to the chase, install BracketHighlighter and set bh_remove_brackets to whatever shortcut you'd like to be able to delete parentheses. Search up bh_remove_brackets in the example sublime keymap to see an example!

Upvotes: 4

user3589620
user3589620

Reputation:

With surround you can do this. Install it via Package Control. (Package Control Installation)

Open the command palette:

CTRLSHIFTP on Linux and Windows,

CMDSHIFTP on Mac.

Search for Surround: delete surround and type in ( and Enter and you are done!

enter image description here

Upvotes: 5

Related Questions