Commit 765c8ae0b4aa

Vincent Demeester <vincent@sbr.pm>
2019-06-27 19:16:31
profiles.zsh: move to .config/zsh and more
- bumping history size - use syntax highlighting and emoji-cli plugins Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent efe5354
Changed files (1)
modules
profiles
modules/profiles/zsh.nix
@@ -1,4 +1,4 @@
-{ config, lib, ... }:
+{ config, lib, pkgs, ... }:
 
 with lib;
 let
@@ -14,26 +14,61 @@ in
       };
     };
   };
-  config = mkIf cfg.enable {
-    programs.zsh = {
-      enable = true;
-      autocd = true;
-      defaultKeymap = "emacs";
-      enableAutosuggestions = true;
-      history = {
-        expireDuplicatesFirst = true;
-        ignoreDups = true;
+  config = mkIf cfg.enable (mkMerge [
+    {
+      home.packages = with pkgs; [
+        zsh-syntax-highlighting
+      ];
+      programs.zsh = {
+        enable = true;
+        dotDir = ".config/zsh";
+        autocd = true;
+        defaultKeymap = "emacs";
+        enableAutosuggestions = true;
+        history = {
+          size = 100000;
+          expireDuplicatesFirst = true;
+          ignoreDups = true;
+        };
+        localVariables = {
+          EMOJI_CLI_KEYBIND = "^n";
+          EMOJI_CLI_USE_EMOJI = "yes";
+        };
+        shellAliases = import ./aliases.shell.nix;
+        plugins = [
+          {
+             # will source emoji-cli.plugin.zsh
+             name = "emoji-cli";
+             src = pkgs.fetchFromGitHub {
+               owner = "b4b4r07";
+               repo = "emoji-cli";
+               rev = "26e2d67d566bfcc741891c8e063a00e0674abc92";
+               sha256 = "0n88w4k5vaz1iyikpmlzdrrkxmfn91x5s4q405k1fxargr1w6bmx";
+             };
+           }
+        ];
+        initExtra = ''
+          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
+        '';
+        profileExtra = ''
+          if [ -e /home/vincent/.nix-profile/etc/profile.d/nix.sh ]; then . /home/vincent/.nix-profile/etc/profile.d/nix.sh; fi
+          export NIX_PATH=$HOME/.nix-defexpr/channels:$NIX_PATH
+        '';
       };
-      shellAliases = import ./aliases.shell.nix;
-      initExtra = ''
-        if [ -e /home/vincent/.nix-profile/etc/profile.d/nix.sh ]; then . /home/vincent/.nix-profile/etc/profile.d/nix.sh; fi
-        autoload -U select-word-style
-        select-word-style bash
-      '';
-      profileExtra = ''
-        if [ -e /home/vincent/.nix-profile/etc/profile.d/nix.sh ]; then . /home/vincent/.nix-profile/etc/profile.d/nix.sh; fi
-        export NIX_PATH=$HOME/.nix-defexpr/channels:$NIX_PATH
-      '';
-    };
-  };
+      programs.fzf = {
+        enable = true;
+        enableZshIntegration = true;
+      };
+    }
+    (mkIf config.profiles.emacs.enable {
+      /*programs.zsh.initExtra = ''
+        export EDITOR=et
+      '';*/
+    })
+    ]);
 }