From 84ca9e452204e385607185ff3772bf5679e4156f Mon Sep 17 00:00:00 2001
From: Austin Horstman <khaneliman12@gmail.com>
Date: Fri, 27 Oct 2023 23:23:55 -0500
Subject: [PATCH] feat: shell improvements

---
 modules/home/suites/common/default.nix    |  8 ++++
 modules/home/system/shell/zsh/default.nix | 55 +++++++++++------------
 modules/nixos/user/default.nix            |  2 +
 3 files changed, 37 insertions(+), 28 deletions(-)

diff --git a/modules/home/suites/common/default.nix b/modules/home/suites/common/default.nix
index ccb9af735..4baf4a1a6 100644
--- a/modules/home/suites/common/default.nix
+++ b/modules/home/suites/common/default.nix
@@ -66,5 +66,13 @@ in
         topgrade = enabled;
       };
     };
+
+    programs.readline = {
+      enable = true;
+
+      extraConfig = ''
+        set completion-ignore-case on
+      '';
+    };
   };
 }
diff --git a/modules/home/system/shell/zsh/default.nix b/modules/home/system/shell/zsh/default.nix
index a2de3500e..98fb02290 100644
--- a/modules/home/system/shell/zsh/default.nix
+++ b/modules/home/system/shell/zsh/default.nix
@@ -23,14 +23,24 @@ in
     programs = {
       zsh = {
         enable = true;
+        package = pkgs.zsh;
+
+        completionInit = ''
+          zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
+        '';
+
         enableAutosuggestions = true;
         enableCompletion = true;
-        syntaxHighlighting.enable = true;
 
         sessionVariables = {
           KEYTIMEOUT = 0;
         };
 
+        syntaxHighlighting = {
+          enable = true;
+          package = pkgs.zsh-syntax-highlighting;
+        };
+
         initExtra = ''
           # Use vim bindings.
           set -o vi
@@ -42,39 +52,18 @@ in
         '';
 
         plugins = [
+          # {
+          #   name = "zsh-autocomplete";
+          #   src = pkgs.zsh-autocomplete;
+          # }
           {
-            name = "zsh-nix-shell";
-            file = "nix-shell.plugin.zsh";
-            src = pkgs.zsh-nix-shell;
-          }
-          {
-            name = "zsh-autocomplete";
-            src = pkgs.zsh-autocomplete;
-          }
-          {
-            name = "zsh-autosuggestions";
-            src = pkgs.zsh-autosuggestions;
-          }
-          {
-            name = "zsh-syntax-highlighting";
-            src = pkgs.zsh-syntax-highlighting;
-          }
-          {
-            name = "zsh-you-should-use";
-            src = pkgs.zsh-you-should-use;
-          }
-          {
-            name = "zsh-history";
-            src = pkgs.zsh-history;
+            name = "zsh-command-time";
+            src = pkgs.zsh-command-time;
           }
           {
             name = "zsh-history";
             src = pkgs.zsh-history;
           }
-          {
-            name = "zsh-command-time";
-            src = pkgs.zsh-command-time;
-          }
           {
             name = "zsh-history-to-fish";
             src = pkgs.zsh-history-to-fish;
@@ -83,6 +72,16 @@ in
             name = "zsh-navigation-tools";
             src = pkgs.zsh-navigation-tools;
           }
+          {
+            name = "zsh-nix-shell";
+            file = "nix-shell.plugin.zsh";
+            src = pkgs.zsh-nix-shell;
+          }
+          {
+            name = "zsh-you-should-use";
+            src = pkgs.zsh-you-should-use;
+          }
+
         ];
       };
     };
diff --git a/modules/nixos/user/default.nix b/modules/nixos/user/default.nix
index bda9e18a8..36792c511 100644
--- a/modules/nixos/user/default.nix
+++ b/modules/nixos/user/default.nix
@@ -58,6 +58,8 @@ in
       propagatedIcon
     ];
 
+    environment.pathsToLink = [ "/share/zsh" ];
+
     programs.zsh = {
       enable = true;
       autosuggestions.enable = true;