5

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?

2
  • 6
    Because it's a vi mode, not a vim mode. daw, diw are vim-only and are not the most useful ones. You can do the same with bdw, bde Feb 20, 2014 at 21:30
  • @StephaneChazelas Doh! I've always used vim. Is there an option to use vim mode (guess not)?
    – jinawee
    Feb 20, 2014 at 21:34

1 Answer 1

4

Because it's a vi mode, not a vim mode. daw, diw are vim-only and are not the most useful ones. You can do the same with bdw, 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.

Update for zsh version ≥ 5.0.8

Since version 5.0.8 zsh also supports vim style text objects. So daw and diw should work out of the box.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.