1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-30 06:59:45 +01:00
home-manager/tests/modules/programs/zsh/history-substring-search.nix
Kiran Ostrolenk 9a2ce65697
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))
2023-10-15 00:09:13 +02:00

25 lines
666 B
Nix

{ config, lib, pkgs, ... }:
with lib;
{
config = {
programs.zsh = {
enable = true;
historySubstringSearch = {
enable = true;
searchDownKey = "^[[B";
searchUpKey = [ "^[[A" "\\eOA" ];
};
};
test.stubs.zsh = { };
# 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$"
'';
};
}