bash: cleanup
authorJulien Moutinho <julm+julm-nix@sourcephile.fr>
Thu, 4 Nov 2021 04:47:13 +0000 (05:47 +0100)
committerJulien Moutinho <julm+julm-nix@sourcephile.fr>
Thu, 4 Nov 2021 05:13:42 +0000 (06:13 +0100)
homes/softwares/bash.nix

index b777ae42f214a7224f7ee6f4df9665a3e3a4b032..e075fc522264d4eb4d7a298ea7c0413b27adf0d8 100644 (file)
@@ -66,26 +66,44 @@ programs.bash = {
     zfs-mount () { for d in $(zfs list -rH -o name "$@"); do sudo zfs mount -l "$d"; done; }
     zfs-unmount () { sudo zfs unmount -u "$@"; }
   '';
+  profileExtra = ''
+  '';
 };
 programs.direnv.enableBashIntegration = true;
 programs.broot.enableBashIntegration = true;
 home.sessionVariables = {
   PS1 = ''\[\033[1;32m\]\[\e]0;\u@\h: \w\a\]\W\[\033[0m\] \$(e=\$?; if [ \$e != 0 ]; then echo '\[\e[0;91m\]'\$e'\[\e[0m\]'; fi)\$ '';
 };
-home.file.".inputrc".text = ''
-  "\e[1~": beginning-of-line
-  "\e[4~": end-of-line
-  "\e[7~": beginning-of-line
-  "\e[8~": end-of-line
-  "\eOH": beginning-of-line
-  "\eOF": end-of-line
-  "\e[H": beginning-of-line
-  "\e[F": end-of-line
-  "\e[1;5C": forward-word
-  "\e[1;5D": backward-word
-  "\e[5C": forward-word
-  "\e[5D": backward-word
-  "\e\e[C": forward-word
-  "\e\e[D": backward-word
-'';
+programs.readline = {
+  enable = lib.mkDefault config.programs.bash.enable;
+  includeSystemConfig = true;
+  bindings = {
+    "\\eOF"    = "end-of-line";
+    "\\eOH"    = "beginning-of-line";
+    "\\e[1;5C" = "forward-word";
+    "\\e[1;5D" = "backward-word";
+    "\\e[1~"   = "beginning-of-line";
+    "\\e[4~"   = "end-of-line";
+    "\\e[5C"   = "forward-word";
+    "\\e[5D"   = "backward-word";
+    "\\e[7~"   = "beginning-of-line";
+    "\\e[8~"   = "end-of-line";
+    "\\e[A"    = "history-search-backward";
+    "\\e[B"    = "history-search-forward";
+    "\\e[F"    = "end-of-line";
+    "\\e[H"    = "beginning-of-line";
+    "\\e\\e[C" = "forward-word";
+    "\\e\\e[D" = "backward-word";
+  };
+  variables = {
+    colored-completion-prefix = lib.mkDefault true;
+    colored-stats = lib.mkDefault true; # Note that this may cause completion text blink in some terminals (e.g. xterm).
+    echo-control-characters = lib.mkDefault true;
+    mark-symlinked-directories = lib.mkDefault true;
+    menu-complete-display-prefix = lib.mkDefault true;
+    show-all-if-ambiguous = lib.mkDefault true;
+    show-all-if-unmodified = lib.mkDefault true;
+    visible-stats = lib.mkDefault false; # Append char to indicate type
+  };
+};
 }