Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove surrounded quotes in vscode or toggle between quote and no quote

Is there any shortcut or extension for vscode which can help to remove surrounded quotes (single ' or double " ) around a selected text?
See example below

'hello' ==> hello

In other words, is it possible to have a feature which will toggle current selection between quotes and no quotes?

I have tried es quotes for vscode which is very nice while switching the quotes between single and double quotes.

like image 664
rahoolm Avatar asked Nov 16 '16 13:11

rahoolm


People also ask

How do you select everything between quotes and Vscode?

Ctrl + K ' select everything between single quotes. Ctrl + K " select everything between double quotes.

How do you escape quotation marks in a string?

' You can put a backslash character followed by a quote ( \" or \' ). This is called an escape sequence and Python will remove the backslash, and put just the quote in the string.


1 Answers

Elaborating on Soldeplata's answer:

Before we start: Look up your shortcut for expanding selection by hitting Ctrl+k,Ctrl+s and search for smartselect (as it could differ with keyboard layout and installed keymap-extensions). I have two shortcuts to choose from: Shift+alt+ or Ctrl+w

The steps (not one shortcut but a small series):

  • Your starting point..................................... Some say: "hello";

  1. Put cursor any where in the word hello
    and use shortcut to expand selection....... Some say: "hello";
  2. Cut selection (Ctrl+x)......................... Some say: "";
  3. Hit backspace once
    (this removes both quotes)...................... Some say: ;
  4. Paste (Ctrl+v).................................... Some say: hello;
like image 73
Superole Avatar answered Sep 19 '22 08:09

Superole