mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 11:39:46 +01:00
zsh: generalize zsh-history-substring-search
Specifically, allow variable expansion for the key codes by switching
from single to double quotes.
This also adds a helpful suggestion to descriptions. Taken from the
project's README, see
4abed97b6e/README.md (L71-L74)
)
This commit is contained in:
parent
a4a72ffd76
commit
9a2ce65697
2 changed files with 9 additions and 7 deletions
|
@ -204,7 +204,8 @@ let
|
|||
default = [ "^[[A" ];
|
||||
description = ''
|
||||
The key codes to be used when searching up.
|
||||
The default of `^[[A` corresponds to the UP key.
|
||||
The default of `^[[A` may correspond to the UP key -- if not, try
|
||||
`$terminfo[kcuu1]`.
|
||||
'';
|
||||
};
|
||||
searchDownKey = mkOption {
|
||||
|
@ -212,7 +213,8 @@ let
|
|||
default = [ "^[[B" ];
|
||||
description = ''
|
||||
The key codes to be used when searching down.
|
||||
The default of `^[[B` corresponds to the DOWN key.
|
||||
The default of `^[[B` may correspond to the DOWN key -- if not, try
|
||||
`$terminfo[kcud1]`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
@ -635,11 +637,11 @@ in
|
|||
''
|
||||
source ${pkgs.zsh-history-substring-search}/share/zsh-history-substring-search/zsh-history-substring-search.zsh
|
||||
${lib.concatMapStringsSep "\n"
|
||||
(upKey: "bindkey '${upKey}' history-substring-search-up")
|
||||
(upKey: "bindkey \"${upKey}\" history-substring-search-up")
|
||||
(lib.toList cfg.historySubstringSearch.searchUpKey)
|
||||
}
|
||||
${lib.concatMapStringsSep "\n"
|
||||
(downKey: "bindkey '${downKey}' history-substring-search-down")
|
||||
(downKey: "bindkey \"${downKey}\" history-substring-search-down")
|
||||
(lib.toList cfg.historySubstringSearch.searchDownKey)
|
||||
}
|
||||
'')
|
||||
|
|
|
@ -17,9 +17,9 @@ with lib;
|
|||
|
||||
# Written with regex to ensure we don't end up missing newlines in the future
|
||||
nmt.script = ''
|
||||
assertFileRegex home-files/.zshrc "^bindkey '\^\[\[B' history-substring-search-down$"
|
||||
assertFileRegex home-files/.zshrc "^bindkey '\^\[\[A' history-substring-search-up$"
|
||||
assertFileRegex home-files/.zshrc "^bindkey '\\\\eOA' history-substring-search-up$"
|
||||
assertFileRegex home-files/.zshrc "^bindkey \"\^\[\[B\" history-substring-search-down$"
|
||||
assertFileRegex home-files/.zshrc "^bindkey \"\^\[\[A\" history-substring-search-up$"
|
||||
assertFileRegex home-files/.zshrc "^bindkey \"\\\\eOA\" history-substring-search-up$"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue