For all text editor or application I'm using, I want to select a word under cursor using keyboard shortcut.
How can I do it? I tried look around I didn't find anything helpful.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
viw (view inside word) enters visual mode and selects the word under the cursor, though in
vi typical usage pattern, you'd rather do things like
diw (delete inside word), or
ciw (change inside word) to change it rather than first select it and do something on it.
W to switch to whitespace delimited words,
a (view a word) to also include the surrounding whitespace in the selection.
2aw to select two words, etc.
You can also always use
b to move to the start of the word and then to
ve to change/delete/view up to the end of the word or
vw to the word (similar kind of distinction as in between
aw). Those (as opposed to
aw which are
vim extensions) are standard
:h iw or
:h aw or more generally
:h motion.txt for details on those motion operators.
That's also available in the line editor of the
zsh shell, when in
vi mode (
bindkey -v to switch to
vi mode from the
There’s no universal single shortcut to do this, however many applications support shortcuts to move the cursor while tracking word boundaries, and select. Using arrow-based key combinations, you should find that Ctrl ← will move to the start of the current word (or the previous word, if the cursor is already at the start of the current word), and then Ctrl Shift → will select the current word.
Some applications use different shortcuts for the above. For example, Emacs supports the arrow-based key combinations now, but historically Emacs users would use Meta B (
M-b), Ctrl Space (
C-SPC), and Meta F (