What hotkey or command helps to select the whole word under the cursor in VSC? (Like CTRL or ALT + D in ST3)
Asked
Active
Viewed 1.1k times
16
-
Note that VSCode has its own tag. – Lex Li Oct 12 '18 at 12:21
-
If you are on Mac, Alt+Left Arrow then Shift+Alt+Right Arrow will select the word. I'm not sure how to select a word by itself. If you go to Help -> Keyboard Shortcuts Reference, you will get a nice little helper page. – Eddie Monge Jr Oct 24 '18 at 18:45
-
Could you explain what you mean with "under the cursor". I want to search the whole word only in VSCode (edit -> find). When searching "hi", I want to get "hi=123" and not "wHite" e.g.. – Timo Nov 09 '20 at 09:50
-
1@Timo: The question is about _selecting_ words. "The word under the cursor" means the sequence of consecutive alphanumeric characters or underscore starting at, ending at, or including the cursor. The cursor is the blinking vertical bar that shows where you are editing. To _find_ or _search_ for whole words, turn on the "Ab-in-a-box" icon next to the find input (which you can get to by tabbing from the input). – Denis Howe Feb 19 '21 at 14:34
-
I think this is a duplicate of [How to select current word in Visual Studio Code (VS Code)?](https://stackoverflow.com/questions/37479982/how-to-select-current-word-in-visual-studio-code-vs-code) – Jo Liss Oct 27 '22 at 16:43
-
If by the whole word under the cursor you intend to select all of words like `fooBar` or `foo_bar`, then see https://stackoverflow.com/questions/76081773/vscode-smart-select-grow-doesnt-honour-word-separators/76567297#76567297 and a new `smartSelect` setting coming in vscode v1.80. – Mark Jun 27 '23 at 17:27
3 Answers
25
To select the word under the cursor in VSCode: ctrl + d

Gary
- 869
- 8
- 5
-
6
-
is there ability to select by word for statements contains few words ? – amigo421 May 08 '20 at 18:08
-
Or Shift+Alt+Right Arrow (if you are at the head of the word) on windows – Arindam Roychowdhury Jan 12 '23 at 13:19
4
Note: the definition of a "word" is different when your document edited with VSCode is a markdown one.
That is why VSCode 1.52 (Nov. 2020) proposes:
Markdown inline smart select
Expand and shrink selection in Markdown documents using the following commands:
- Expand:
kb(editor.action.smartSelect.expand)
- Shrink:
kb(editor.action.smartSelect.shrink)
Selection applies to italics, bold, inline code blocks, and links.

VonC
- 1,262,500
- 529
- 4,410
- 5,250