summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2020-03-02 15:10:32 +0100
committerAlan Pearce2020-03-02 15:10:32 +0100
commit018c4cbf631cb86b765c6ef40dd33c94105d5e0a (patch)
tree83d84f21ba5cd996249c7719000949f4c2747643
parentd820aae57b976d2fa935f48f18ac905ca0d5179e (diff)
downloadnixfiles-018c4cbf631cb86b765c6ef40dd33c94105d5e0a.tar.lz
nixfiles-018c4cbf631cb86b765c6ef40dd33c94105d5e0a.tar.zst
nixfiles-018c4cbf631cb86b765c6ef40dd33c94105d5e0a.zip
zsh: optimise startup
- compile init file
- pre-generate and compile compinit dump (zcompdump)
-rw-r--r--user/settings/zsh.nix3
1 files changed, 3 insertions, 0 deletions
diff --git a/user/settings/zsh.nix b/user/settings/zsh.nix
index 5d62101a..b409e728 100644
--- a/user/settings/zsh.nix
+++ b/user/settings/zsh.nix
@@ -4,6 +4,7 @@ let
   inherit (pkgs) stdenv;
   lsOptions = if stdenv.isDarwin then "-p" else "-v --group-directories-first";
   lsIsoDate = if stdenv.isDarwin then "" else "--time-style=long-iso";
+  zshrc = ".config/zsh/.zshrc";
   mkZshPlugin = attrs: {
     name = attrs.name;
     src = stdenv.mkDerivation {
@@ -254,4 +255,6 @@ in
 
     '' + builtins.readFile ../zsh/.config/zsh/.zshrc;
   };
+
+  home.file."${zshrc}".onChange = "${pkgs.zsh}/bin/zsh -i -c 'autoload -Uz compinit && compinit && zcompile ${zshrc}'";
 }