Apparently since the release of bash v. 5 some weeks ago (witnessed on Arch Linux and Debian Buster), the default behaviour of invoking the editor in vi mode has changed.

set -o vi

bash 4.x and earlier: an empty $EDITOR pops up.

bash 5.x: $EDITOR opens with the last executed command (resembling the fc command).

Accidental opening of the command-line editor and violently :q!ing it leads to the repeated execution of the last command. For a long-time vi-mode addict, this is unexpected behaviour and violates the principle of least astonishment. How to revert to the old empty-editor state?


1 Answer 1


Unfortunately, this has turned out to be a real bug in bash, that has already found its way into major distribution releases like, amongst others, Debian Buster and FreeBSD 11.3 and 12.0.

At least for Arch Linux, there is bash-devel-git that is not affected.

  • 1
    some links to the bug-bash discussions and/or git commits will not hurt.
    – user313992
    Commented Jul 15, 2019 at 21:31
  • Just spent the last few minutes trying to see what I messed up in my bash config that caused this annoying :q! behavior, and took me a while to find this. Surprised to find this is an actual bug in bash
    – Max Coplan
    Commented Jul 25, 2019 at 21:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .