Reputation: 3553
I had to reinstall VS Code recently, I rember using Ctrl+W to kind of smart select everything between quotes but now what that command does is move me to another file/tab instead? Is there a way to do this in VS Code, Ctrl+W was just so easy to me, really helped with deleting or copying strings of text.
Upvotes: 30
Views: 40441
Reputation: 2039
As @Mark says in the comment, you can use the "Expand Selection" shortcut. The first press will select the word to the right of the cursor. The second press selects everything between the quotes.
The shortcut on Windows by default:
Shift + Alt + →
And OS X:
Ctrl + Shift + ⌘ + →
Upvotes: 32
Reputation: 691
Try using the Quick and Simple Text Selection extension.
On a Mac, the extension's default shortcut is ⌘ k, ". This is a chord, so:
This will select everything in double quotes.
If you want to select everything in single quotes use ⌘ k, '
It also works for brackets and back ticks
On Windows, replace ⌘ with Ctrl
Upvotes: 23
Reputation: 691
After re-reading your question, I noticed that you want to press Ctrl + W to press multiple times to expand your selection
To see and set the shortcut, you can
Press Ctrl/Cmd + Shift + P
Go to Keyboard Shortcuts by typing Preferences: Open Keyboard Shortcuts
Search for the command: editor.action.smartSelect.expand
Double click the keybinding to set a new keybinding
Upvotes: 5
Reputation: 29
The quick and simple text selection does not account for escaped quotes. So if you have "Hello "World"" and your cursor is on Hello, it will only select to the quote preceding World.
Upvotes: -1
Reputation: 310
The best / simplest way to do it I've found on Mac is to click the text anywhere in the quote marks, then hold down Control + Shift and tap the right arrow twice.
Upvotes: 13
Reputation: 79
Shift + Alt + (Right Arrow) for the word next to cursor Shift + Alt + (Right Arrow)x2 for entire sentence between quotes
Upvotes: 7