mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 22:50:39 +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");
|
abort ("values ${toPretty v} is of unsupported type");
|
||||||
in "set ${n} ${mkValueStr v}";
|
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 {
|
in {
|
||||||
options.programs.readline = {
|
options.programs.readline = {
|
||||||
|
|
|
@ -7,7 +7,10 @@ with lib;
|
||||||
programs.readline = {
|
programs.readline = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
bindings = { "\\C-h" = "backward-kill-word"; };
|
bindings = {
|
||||||
|
"\\C-h" = "backward-kill-word";
|
||||||
|
"Control-p" = ''"whups"'';
|
||||||
|
};
|
||||||
|
|
||||||
variables = {
|
variables = {
|
||||||
bell-style = "audible";
|
bell-style = "audible";
|
||||||
|
|
|
@ -4,6 +4,7 @@ $include /etc/inputrc
|
||||||
set bell-style audible
|
set bell-style audible
|
||||||
set completion-map-case on
|
set completion-map-case on
|
||||||
set completion-prefix-display-length 2
|
set completion-prefix-display-length 2
|
||||||
|
Control-p: "whups"
|
||||||
"\C-h": backward-kill-word
|
"\C-h": backward-kill-word
|
||||||
$if mode=emacs
|
$if mode=emacs
|
||||||
"\e[1~": beginning-of-line
|
"\e[1~": beginning-of-line
|
||||||
|
|
Loading…
Reference in a new issue