TransWikia.com

In zsh vim mode, when replacing multiple characters, backspace does not work as expected

Unix & Linux Asked by pfnuesel on November 16, 2021

I want to do the following: In the console, in vim mode, replace several characters (vim command R), while being able to revert the changes with backspace. In bash it works the same as in vim:

bash
set -o vi
echo "foo bar" <ESC>

Now move back to say "f" with vim commands, e.g. Ff, then R to replace multiple characters. I can now write e.g. bar foo, then I get

echo "bar foo"

And now press BACKSPACE e.g. three times, then I see

echo "bar bar"

That’s the behaviour I want, it’s the same as in vim. However, in zsh, I can try similarly:

zsh
bindkey -v
echo "foo bar" <ESC>

Do the same thing as above, but end with:

echo "bar "

In short: The behaviour of replacing multiple characters in zsh is not working as expected when using BACKSPACE. Instead of reverting the character to what it was before, it is simply deleted.

How can I get the same behaviour in zsh as in vim?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP