Only bind when in line editing is enabled

This commit is contained in:
tsi 2026-01-03 01:29:33 +01:00
parent 342d792a9d
commit 1603269905
No known key found for this signature in database

View file

@ -353,10 +353,18 @@ bash_abbr () {
# called as many times as possible before recursion would happen.
# This is pretty hard, and surely even harder to do efficiently,
# so it will probably never be implemented.
bind -x '"\e\C-an": _try_abbrev ""'
bind '"\e\C-j": accept-line'
bind '"\C-m": "\e\C-an\e^\e\C-j"'
bind '"\C-j": "\C-m"'
bind_if -x '"\e\C-an": _try_abbrev ""'
bind_if '"\e\C-j": accept-line'
bind_if '"\C-m": "\e\C-an\e^\e\C-j"'
bind_if '"\C-j": "\C-m"'
}
has_line_editing () {
shopt -qo emacs || shopt -qo vi
}
bind_if () {
has_line_editing && builtin bind "$@" || true
}
bash_abbr