1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00

zsh: fix zsh history substring search generation

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
Austin Horstman 2025-10-10 15:44:12 -05:00
parent bcccb01d0a
commit d305eece82
2 changed files with 9 additions and 41 deletions

View file

@ -247,28 +247,12 @@ in
# https://github.com/zsh-users/zsh-history-substring-search#usage
''
source ${pkgs.zsh-history-substring-search}/share/zsh-history-substring-search/zsh-history-substring-search.zsh
${
let
upKeys = lib.toList cfg.historySubstringSearch.searchUpKey;
downKeys = lib.toList cfg.historySubstringSearch.searchDownKey;
in
''
# Bind search up keys
${lib.hm.zsh.define "search_up_keys" upKeys}
for key in "''${search_up_keys[@]}"; do
bindkey "$key" history-substring-search-up
done
unset key search_up_keys
# Bind search down keys
${lib.hm.zsh.define "search_down_keys" downKeys}
for key in "''${search_down_keys[@]}"; do
bindkey "$key" history-substring-search-down
done
unset key search_down_keys
''
}
${lib.concatMapStringsSep "\n" (upKey: ''bindkey "${upKey}" history-substring-search-up'') (
lib.toList cfg.historySubstringSearch.searchUpKey
)}
${lib.concatMapStringsSep "\n" (downKey: ''bindkey "${downKey}" history-substring-search-down'') (
lib.toList cfg.historySubstringSearch.searchDownKey
)}
''
))
];

View file

@ -36,22 +36,6 @@ done
unset opt disabled_opts
source @zsh-history-substring-search@/share/zsh-history-substring-search/zsh-history-substring-search.zsh
# Bind search up keys
search_up_keys=(
'^[[A' '\eOA'
)
for key in "${search_up_keys[@]}"; do
bindkey "$key" history-substring-search-up
done
unset key search_up_keys
# Bind search down keys
search_down_keys=(
'^[[B'
)
for key in "${search_down_keys[@]}"; do
bindkey "$key" history-substring-search-down
done
unset key search_down_keys
bindkey "^[[A" history-substring-search-up
bindkey "\eOA" history-substring-search-up
bindkey "^[[B" history-substring-search-down