Você quer a configuração readline:
set revert-all-at-newline on
Você pode colocá-lo em ~/.inputrc
(veja a nota abaixo) ou colocar bind 'revert-all-at-newline on'
no seu ~/.bashrc
.
Demo:
$ man bash
$ bind 'set revert-all-at-newline on'
$ man bsh # up arrow and edit
No manual entry for bsh
$ man bash # three up arrows
Mais detalhes estão na página de manual do Bash :
revert-all-at-newline
If set to ‘
on
’, Readline will undo all changes to history lines before returning when accept-line is executed. By default, history lines may be modified and retain individual undo lists across calls to readline. The default is ‘off
’.
Note:
If a new
~/.inputrc
file is created for the purpose of settingrevert-all-at-newline
, be aware that bash will use the readline settings in this file instead of any settings which may be in the file/etc/inputrc
. That is, any settings specified in/etc/inputrc
will no longer be in effect. Therefore, if the/etc/inputrc
file exists, it's a good idea to start~/.inputrc
with the line:
$include /etc/inputrc