BASH_UNDOREDO(1) General Commands Manual BASH_UNDOREDO(1)

bash_undoredo - expand bash bindcmd 'undo' to 'undo/redo'

bash_undoredo [-hHV]
bash_undoredo [-Q]

~$ bash_undoredo -Q #>> output corecode
#--- ~/.bashrc
(..your ini...)
(..copy the '-Q' output funcs)
  #--prepare callback
bind '"\C-org_undo": undo ' #>> need the readline built-in 'undo'
bind -x '"\C-bur_undo": bur_undo'
bind -x '"\C-bur_undo_sub": bur_undo_diff'
  #--main_keybind 'undo/redo'
bind '"\b": "\C-bur_undo\C-org_undo\C-bur_undo_sub" ' #>> \b==ctrl-bksp
bind -x '"\C-r": bur_redo'	#>> ctrl-r == redo
#---
#--test
~$ hello,wor(ld)	#-- input str then del 2char (ld)
~$ hello,worl	#-- undo: ctrl-bs
~$ hello,world	#-- undo: ctrl-bs
~$ hello,worl	#-- redo: ctrl-r
~$ hello,wor	#-- redo: ctrl-r

-hHV
help, version
-Q
output corecode

bash 'readline' has 'undo' cmd for keybind but 'redo' doesnt. this script provides 'undo/redo' functions.

suc/fail == 0/not0 (raise err/emsg if fatal)

rollback history size is 100, hardcoded. this script uses names 'bur_XX' for var/funcs

posix-shell

Copyright (C) 2023 Momi-g, AGPLv3+

2023-06-25 v1.0.0 (2023-06-25 v1.0.0)

bash(1), readline(3)