I've used set -o vi on bash for a while.

However, I've started using zsh, and I've found that when I try to use the "delete" key (backspace for mac), it doesn't delete non-inserted text.

For instance: I can delete anything I've typed that using delete.

However, if I copy the command above (by the above arrow or k), I can't delete it.

For vim, I think I can do it with set backspace=indent eol start in ~/.vimrc, but not sure how I can make that change with vi? Also unsure why it works in bash but not in zsh.

  • Welcome to Vi and Vim! Since zsh's vi-mode is not on-topic according to help center, I've closed this question.
    – D. Ben Knoble
    Jun 28 at 20:18
  • @D.BenKnoble Thank you for the welcome. However, I disagree that this is off-topic: to quote the help center: "Questions about plugins that replicate Vim's editing model in other editors (VSCode, Sublime Text, Emacs, etc.) may be on topic if they are about features or behavior that also exists in Vi". I don't see how replicating vi features in zsh is different from doing so in emacs.
    – ppwc
    Jun 28 at 20:23
  • I should have been more precise in my statement: the vi-like behavior is (probably) on-topic. Tweaking zsh's ZLE to make it more vi-like (or emulate :set backspace=indent,eol,start) is not.
    – D. Ben Knoble
    Jun 28 at 20:25

After your bindkey -v command in your zshrc, put these commands:

bindkey "^H" backward-delete-char
bindkey "^?" backward-delete-char

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