Delete opening and closing quotes (or brackets, curly braces, etc.)

Open and close quotes (or brackets, braces, etc.) are highlighted in PyCharm (and other editors). Thus, this means that he can identify the pair.

Now, is there a way to remove both quotation marks at once (or brackets, curly braces, etc.) when either of the opening or closing quotes is removed, as it identifies the pair?

For example, I want this to be in one action on the keyboard (in both cases, either the opening or closing square bracket was deleted):
From this: [[a for a in l1 if a!=0]]
To this: [a for a in l1 if a!=0]

I googled and searched on SO but could not find it.

+5
source share
1 answer

I know 2 quick ways, but none of them are fast enough.

1: Using the AceJump addon, you just go to one guy, delete delete, then go to another and delete delete ... Naturally, this has the disadvantage that the brackets are in this situation: ([{(([]))}) it would be harder to go to.

2: There is a command called "Move the carriage to fit the curly brace." Then, using AceJump to jump directly to your first curly brace (or just move to it in any way), you activate the "Move carriage to curly brace 2 times" function. After moving the carriage 2 times, you can delete the first matching parsers, and then use the action to go back ("Back"), and then delete the second shape.

3: Solution 2 does not work for quotes. For them, instead of performing the action "Move to the curly bracket", you can use the incremental selection and go to the most convenient of the two quotation marks ... This, however, does not allow you to return to the previous (or next) quote and delete it. Therefore, I don’t have a solution for quotes, but this “incremental choice” can work in several situations (when one of the quotes is at the beginning or end of the line)

0
source

Source: https://habr.com/ru/post/1260862/


All Articles