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?


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. – Uncle Billy 2 days ago

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.