13
votes

Is there a keyboard shortcut (or customizable keyboard shortcut) to select text inside a single quote '' and double quotes "" in Visual Studio 2012.

eg:

string name = "John Doe";

instead of dragging the mouse to select all of John Doe, is there a way to just point the cursor inside the double quotes and press a key combination to select it? Wanting to avoid usage of mouse a much a possible.

I found a similar question

Visual Studio / R# Keyboard shortcuts: select string with or without quotes

but the shortcut given will only select a particular text, not the entire text inside quotes

TIA

7
I've been looking for the answer to this for some time. This functionality exists in an IDE I use for a legacy language (APL) as Ctrl + Shift + M. I hate not having this in VS. - Sam
For google guys, in Visual Studio 2013 : put the cursor wherever you want in the string between quotes and then press CTRL+W. That's it. - tobiak777

7 Answers

7
votes

In researching this I have found two answers:

Answer the first

Ctrl+Shift+W will select the text of the word that your cursor is on within a string. Press it again to select the text of the entire string without the quotes, again to select the quotes, again to select the next logical container and so on.

Answer the second

If you use ReSharper you can use Ctrl+Alt+Right Arrow to do the same thing as Ctrl+Shift+W. You can also use Ctrl+Alt+Left Arrow to reduce your selection by one logical container.

5
votes

In Visual Studio 2013 it was Ctrl+Right Click. You can use Ctrl+Shift+] for Visual Studio 2015 ;)

3
votes

TLDR; CTRL+W+W


I am using visual studio 2017 with ReSharper. I don't know if it is ReSharper that added the command or if it is native to VS2017 but using my set-up it is possible to select the text within quotes by putting the cursor in between the quotes and hitting CTRL+W+W

The first CTRL+W will select the word closest to the cursor. Hitting W again will select everything between the quotes.

2
votes

I am not aware of such keyboard shortcut.

The following quick trick uses mouse and includes double quotes.

Just double click left to the first double quote, VS will select the entire string (including the enclosing double quotes).

0
votes

Apparently the functionality that you're looking for doesn't exists (http://msdn.microsoft.com/en-us/library/da5kh0wa.aspx) For do that I use ctrl+shift+ arrows to select quickly but is not a visual studio functionality is global for all text editors.

regards.

0
votes

In Visual Studio 2013 I was able to do this by Ctrl+Left Click on the start of the string quote (that is on the left side of the (") sign). Moving to VS 2015 this functionality no longer works for me and I would love to know how to trun it back on.

-1
votes

Use (Ctrl + Shift + W) in Visual studio. just move cursor before " and use this combinations of keys.