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
?plain=1#L71-L74)
This commit is contained in:
parent
a4a72ffd76
commit
9a2ce65697
|
@ -204,7 +204,8 @@ let
|
||||||
default = [ "^[[A" ];
|
default = [ "^[[A" ];
|
||||||
description = ''
|
description = ''
|
||||||
The key codes to be used when searching up.
|
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 {
|
searchDownKey = mkOption {
|
||||||
|
@ -212,7 +213,8 @@ let
|
||||||
default = [ "^[[B" ];
|
default = [ "^[[B" ];
|
||||||
description = ''
|
description = ''
|
||||||
The key codes to be used when searching down.
|
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
|
source ${pkgs.zsh-history-substring-search}/share/zsh-history-substring-search/zsh-history-substring-search.zsh
|
||||||
${lib.concatMapStringsSep "\n"
|
${lib.concatMapStringsSep "\n"
|
||||||
(upKey: "bindkey '${upKey}' history-substring-search-up")
|
(upKey: "bindkey \"${upKey}\" history-substring-search-up")
|
||||||
(lib.toList cfg.historySubstringSearch.searchUpKey)
|
(lib.toList cfg.historySubstringSearch.searchUpKey)
|
||||||
}
|
}
|
||||||
${lib.concatMapStringsSep "\n"
|
${lib.concatMapStringsSep "\n"
|
||||||
(downKey: "bindkey '${downKey}' history-substring-search-down")
|
(downKey: "bindkey \"${downKey}\" history-substring-search-down")
|
||||||
(lib.toList cfg.historySubstringSearch.searchDownKey)
|
(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
|
# Written with regex to ensure we don't end up missing newlines in the future
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
assertFileRegex home-files/.zshrc "^bindkey '\^\[\[B' history-substring-search-down$"
|
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 \"\^\[\[A\" history-substring-search-up$"
|
||||||
assertFileRegex home-files/.zshrc "^bindkey '\\\\eOA' history-substring-search-up$"
|
assertFileRegex home-files/.zshrc "^bindkey \"\\\\eOA\" history-substring-search-up$"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue