I've seen that the vi mode option in zsh is rather limited.
For example, 'daw' (delete around word) and 'diw' don't work.
What is the reason and how can I solve it?
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 communityBecause it's a
vi
mode, not avim
mode.daw
,diw
are vim-only and are not the most useful ones. You can do the same withbdw
,bde
– Stephane Chazelas
That being said you can use bindkey -s
to bind one string to another:
bindkey -a -s "diw" "bde"
bindkey -a -s "daw" "bdw"
Now when you type diw
bde
is sent back.
-a
is needed to add the binding to the vicmd
mode.
Since version 5.0.8 zsh also supports vim style text objects. So daw
and diw
should work out of the box.
vi
mode, not avim
mode.daw
,diw
are vim-only and are not the most useful ones. You can do the same withbdw
,bde