Add accept-or-recall-and-infer-history
Pressing Alt-Enter now uses accept-and-infer-history, with the addition of using the last executed command for inferring if pressed while the command line is empty
This commit is contained in:
parent
c5211a17f1
commit
cebda88f7b
2 changed files with 19 additions and 1 deletions
|
@ -62,4 +62,19 @@ zle -N zle-line-finish
|
|||
|
||||
insert_sudo () { zle beginning-of-line; zle -U "sudo " }
|
||||
zle -N insert-sudo insert_sudo
|
||||
|
||||
bindkey "^[s" insert-sudo
|
||||
|
||||
local function accept-or-recall-and-infer-history() {
|
||||
if [[ -z $PREBUFFER$BUFFER ]]; then
|
||||
zle up-line-or-history
|
||||
zle infer-next-history
|
||||
|
||||
else
|
||||
zle accept-and-infer-next-history -- "$@"
|
||||
fi
|
||||
}
|
||||
zle -N accept-or-recall-and-infer-history
|
||||
|
||||
|
||||
bindkey "\e^M" accept-or-recall-and-infer-history
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue