Add Emacs-like delete-horizontal-space and just-one-space key binds
This commit is contained in:
parent
108d8ac5a3
commit
645710c31d
17
.zshrc
17
.zshrc
@ -62,6 +62,23 @@ zstyle ':completion:*' matcher-list 'm:{[:lower:]-}={[:upper:]_} r:|[.]=**' '+l:
|
||||
bindkey '^[[5~' history-substring-search-up
|
||||
bindkey '^[[6~' history-substring-search-down
|
||||
|
||||
# equivalents of eponymous Emacs functions
|
||||
# from https://unix.stackexchange.com/a/595157
|
||||
delete-horizontal-space() {
|
||||
emulate -L zsh
|
||||
set -o extendedglob
|
||||
LBUFFER=${LBUFFER%%[[:blank:]]##}
|
||||
RBUFFER=${RBUFFER##[[:blank:]]##}
|
||||
}
|
||||
zle -N delete-horizontal-space
|
||||
bindkey '\e\\' delete-horizontal-space
|
||||
just-one-space() {
|
||||
delete-horizontal-space
|
||||
LBUFFER="$LBUFFER "
|
||||
}
|
||||
zle -N just-one-space
|
||||
bindkey '\e ' just-one-space
|
||||
|
||||
# Inserts 'sudo ' at the beginning of the line.
|
||||
function prepend-sudo() {
|
||||
if [[ "$BUFFER" != su(do|)\ * ]]; then
|
||||
|
Loading…
Reference in New Issue
Block a user