history-substring-search.plugin.zsh
854 bytes
1# Handle $0 according to the standard:
2# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
30="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
40="${${(M)0:#/*}:-$PWD/$0}"
5
6# Respect case sensitivity settings for globbing in history search
7if [[ "$CASE_SENSITIVE" = true ]]; then
8 : ${HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS=''}
9else
10 : ${HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'}
11fi
12
13source ${0:A:h}/history-substring-search.zsh
14
15
16# Bind terminal-specific up and down keys
17
18if [[ -n "$terminfo[kcuu1]" ]]; then
19 bindkey -M emacs "$terminfo[kcuu1]" history-substring-search-up
20 bindkey -M viins "$terminfo[kcuu1]" history-substring-search-up
21fi
22if [[ -n "$terminfo[kcud1]" ]]; then
23 bindkey -M emacs "$terminfo[kcud1]" history-substring-search-down
24 bindkey -M viins "$terminfo[kcud1]" history-substring-search-down
25fi