Only bind when in line editing is enabled
This commit is contained in:
parent
342d792a9d
commit
1603269905
1 changed files with 12 additions and 4 deletions
16
bash-abbr
16
bash-abbr
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue