dotfiles/home/private_dot_config/zsh/functions/history-substring-search-keybinds

25 lines
718 B
Bash

##? Post load function for zsh-history-substring-search plugin
# function history-substring-search-keybinds {
# https://github.com/zsh-users/zsh-history-substring-search
if [[ -n "$key_info" ]]; then
# Emacs
bindkey -M emacs "$key_info[Control]P" history-substring-search-up
bindkey -M emacs "$key_info[Control]N" history-substring-search-down
# Vi
bindkey -M vicmd "k" history-substring-search-up
bindkey -M vicmd "j" history-substring-search-down
# Emacs and Vi
for keymap in 'emacs' 'viins'; do
bindkey -M "$keymap" "$key_info[Up]" history-substring-search-up
bindkey -M "$keymap" "$key_info[Down]" history-substring-search-down
done
unset keymap
fi
# }
# vim: ft=zsh sw=2 ts=2 et