1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-21 17:59:39 +01:00

readline: Add support for keynames (#3947)

Kenames like `Control-n` or `meta-p` should not be quoted or they don't work.

Keyseqs like `\C-p` or `ab` must continue to be quoted.

See also: https://www.gnu.org/software/bash/manual/html_node/Readline-Init-File-Syntax.html

Fixes https://github.com/nix-community/home-manager/issues/3611
This commit is contained in:
Nathan Henrie 2023-05-04 11:39:46 -06:00 committed by GitHub
parent ae6d5466bf
commit f3824311a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View file

@ -21,7 +21,14 @@ let
abort ("values ${toPretty v} is of unsupported type");
in "set ${n} ${mkValueStr v}";
mkBindingStr = k: v: ''"${k}": ${v}'';
mkBindingStr = k: v:
let
isKeynameNotKeyseq = k:
builtins.elem (builtins.head (lib.splitString "-" (toLower k))) [
"control"
"meta"
];
in if isKeynameNotKeyseq k then "${k}: ${v}" else ''"${k}": ${v}'';
in {
options.programs.readline = {