mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00: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:
parent
ae6d5466bf
commit
f3824311a1
3 changed files with 13 additions and 2 deletions
|
@ -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 = {
|
||||
|
|
|
@ -7,7 +7,10 @@ with lib;
|
|||
programs.readline = {
|
||||
enable = true;
|
||||
|
||||
bindings = { "\\C-h" = "backward-kill-word"; };
|
||||
bindings = {
|
||||
"\\C-h" = "backward-kill-word";
|
||||
"Control-p" = ''"whups"'';
|
||||
};
|
||||
|
||||
variables = {
|
||||
bell-style = "audible";
|
||||
|
|
|
@ -4,6 +4,7 @@ $include /etc/inputrc
|
|||
set bell-style audible
|
||||
set completion-map-case on
|
||||
set completion-prefix-display-length 2
|
||||
Control-p: "whups"
|
||||
"\C-h": backward-kill-word
|
||||
$if mode=emacs
|
||||
"\e[1~": beginning-of-line
|
||||
|
|
Loading…
Reference in a new issue