3

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
<Esc>v

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

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.

| improve this answer | |
  • 1
    some links to the bug-bash discussions and/or git commits will not hurt. – Uncle Billy Jul 15 '19 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 Jul 25 '19 at 21:51

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.