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

26 lines
718 B
Text
Raw Permalink Normal View History

2023-02-17 09:26:31 -06:00
##? 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