zsh-config/keyboard
Robert Morrison a2b2f52710
Stuff
2021-12-27 23:42:59 +00:00

27 lines
1.2 KiB
Plaintext
Executable File

## Use zkbd to set automagical keybinkds
## this can fix terminals that have different outputs for keys than expoected
autoload -Uz zkbd
if [[ -f $HOME/.zkbd/$TERM-${DISPLAY:-$VENDOR-$OSTYPE} ]]; then
source $HOME/.zkbd/$TERM-${DISPLAY:-$VENDOR-$OSTYPE}
else
echo "WARNING: Keybindingd may not be set correctly!"
echo "Execute \`zkbd\` to create bindings."
fi
zle -N history-beginning-search-backward-end \
history-search-end
zle -N history-beginning-search-forward-end \
history-search-end
[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
[[ -n "${key[Backspace]}" ]] && bindkey "${key[Backspace]}" backward-delete-char
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-search
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-search
[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char