Commit 13c095fefc5d

Vincent Demeester <vincent@sbr.pm>
2019-06-28 11:30:54
profiles.zsh: remove zsh-history-sbustring-search…
… and use pure as prompt Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent a1299ab
Changed files (1)
modules
profiles
modules/profiles/zsh.nix
@@ -47,28 +47,58 @@ in
              };
            }
           {
-             name = "zsh-history-substring-search";
+             name = "async";
              src = pkgs.fetchFromGitHub {
-               owner = "zsh-users";
-               repo = "zsh-history-substring-search";
-               rev = "0f80b8eb3368b46e5e573c1d91ae69eb095db3fb";
-               sha256 = "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y";
+               owner = "mafredri";
+               repo = "zsh-async";
+               rev = "v1.7.0";
+               sha256 = "1jbbypgn0r4pilhv2s2p11vbkkvlnf75wrhxfcvr7bfjpzyp9wbc";
+             };
+           }
+          {
+             name = "pure";
+             src = pkgs.fetchFromGitHub {
+               owner = "sindresorhus";
+               repo = "pure";
+               rev = "v1.10.3";
+               sha256 = "0zjgnlw01ri0brx108n6miw4y0cxd6al1bh28m8v8ygshm94p1zx";
              };
            }
         ];
         initExtra = ''
+          IS_SERIAL=0
+          case $TTY in
+            /dev/ttyS[0-9]*|/dev/ttyUSB[0-9]*)
+            IS_SERIAL=1
+            ;;
+          esac
+          IS_CHROOT=0
+          if [[ $UID == 0 ]] && [[ $(stat -c %d:%i /) != $(stat -c %d:%i /proc/1/root/.) ]]; then
+            IS_CHROOT=1
+          fi
+          PURE_PROMPT='λ'
+          autoload -Uz select-word-style; select-word-style bash
           if [ -e /home/vincent/.nix-profile/etc/profile.d/nix.sh ]; then . /home/vincent/.nix-profile/etc/profile.d/nix.sh; fi
           # make sure navigation using emacs keybindings works on all non-alphanumerics
-          autoload -U select-word-style
-          select-word-style bash
           # syntax highlighting
           source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
           ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red')
           ZSH_HIGHLIGHT_PATTERNS+=('rm -fR *' 'fg=white,bold,bg=red')
           ZSH_HIGHLIGHT_PATTERNS+=('rm -fr *' 'fg=white,bold,bg=red')
-          # history-substring-search
-          bindkey '^[[A' history-substring-search-up
-          bindkey '^[[B' history-substring-search-down
+          # prompt
+          autoload -Uz promptinit; promptinit
+          PURE_CMD_MAX_EXEC_TIME=10
+          zstyle :prompt:pure:path color white
+          PURE_PROMPT_SYMBOL='λ'
+          if (( IS_CHROOT )); then
+            PURE_PROMPT_SYMBOL='(chroot) λ'
+          fi
+          if (( IS_SERIAL )); then
+            # Serial can't handle beautiful symbols or setting the title ;).
+            PURE_PROMPT_SYMBOL='>'
+            prompt_pure_set_title() {}
+          fi
+          prompt pure
         '';
         profileExtra = ''
           if [ -e /home/vincent/.nix-profile/etc/profile.d/nix.sh ]; then . /home/vincent/.nix-profile/etc/profile.d/nix.sh; fi
@@ -79,6 +109,10 @@ in
         enable = true;
         enableZshIntegration = true;
       };
+      programs.z-lua = {
+        enable = true;
+        enableZshIntegration = true;
+      };
     }
     (mkIf config.profiles.emacs.enable {
       /*programs.zsh.initExtra = ''