vishnu
vishnu

Reputation: 740

Keyboard shortcut to select text inside quotes in Visual Studio 2012

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

Upvotes: 17

Views: 16045

Answers (8)

Frederic
Frederic

Reputation: 1810

As of VS2019, with the cursor inside the string, ALT+SHIFT+= will select the whole string, including the surrounding quotes.

Upvotes: 4

Mathieu VIALES
Mathieu VIALES

Reputation: 4772

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.

Upvotes: 4

cubrman
cubrman

Reputation: 944

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.

Upvotes: 0

Ivandro Jao
Ivandro Jao

Reputation: 2961

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

Upvotes: 5

Henry W
Henry W

Reputation: 31

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).

Upvotes: 2

Sam
Sam

Reputation: 922

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.

Upvotes: 7

vfabre
vfabre

Reputation: 1408

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.

Upvotes: 0

Morteza Azizi
Morteza Azizi

Reputation: 479

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

Upvotes: -2

Related Questions