zsh-config/keyboard
2022-02-20 00:07:32 +00:00

29 lines
1.3 KiB
Bash
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 $ZDOTDIR/.zkbd/$TERM-${DISPLAY:-$VENDOR-$OSTYPE} ]]; then
source $ZDOTDIR/.zkbd/$TERM-${DISPLAY:-$VENDOR-$OSTYPE}
else
echo "No mappings for $TERM-${DISPLAY:-$VENDOR-$OSTYPE}"
echo "WARNING: Keybindings 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
# vim: set ft=zsh ts=8 sw=4 tw=0 noet :