about summary refs log tree commit diff stats
path: root/nix-conf/home/includes/zsh.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix-conf/home/includes/zsh.nix')
-rw-r--r--nix-conf/home/includes/zsh.nix121
1 files changed, 60 insertions, 61 deletions
diff --git a/nix-conf/home/includes/zsh.nix b/nix-conf/home/includes/zsh.nix
index 049bd88..9a8c1cf 100644
--- a/nix-conf/home/includes/zsh.nix
+++ b/nix-conf/home/includes/zsh.nix
@@ -1,6 +1,13 @@
-{ config, pkgs, lib, ... }:
-let inherit (lib) optionalAttrs optionals;
-in {
+{
+  config,
+  pkgs,
+  lib,
+  ...
+}:
+let
+  inherit (lib) optionalAttrs optionals;
+in
+{
   home.packages = with pkgs; [ zsh-completions ];
 
   programs.fzf = {
@@ -17,8 +24,15 @@ in {
   };
   programs.keychain = {
     enable = lib.mkIf pkgs.stdenv.isLinux true;
-    agents = [ "ssh" "gpg" ];
-    keys = [ "id_rsa" "id_ed25519" "C171251002C200F2" ];
+    agents = [
+      "ssh"
+      "gpg"
+    ];
+    keys = [
+      "id_rsa"
+      "id_ed25519"
+      "C171251002C200F2"
+    ];
     #  extraFlags = [ "--quiet" "--ignore-missing" ];
   };
   programs.command-not-found.enable = true;
@@ -52,24 +66,16 @@ in {
 
       pp = ''pushbullet push "Pixel" link "''${1}" "''${1}"'';
 
-      upgrade_emacs = ''
-        cp ~/.emacs.d/straight/versions/default.el ~/straight-versions-default-`date "+%Y-%m-%d-%H%M%S"`.el && emacs --batch -l "~/.emacs.d/init.el" -f "my/upgrade-packages"'';
-      diff_emacs =
-        "difft --color always --context 0 $(ls -d1v ~/straight-versions-default-*.el | tail -1) ~/.emacs.d/straight/versions/default.el | grep '\\[9[12]' | egrep -v '(gnu-elpa-mirror|nongnu-elpa|melpa|emacsmirror-mirror)'";
-
-      nix-up =
-        "git -C ~/dotfiles pull && doas nix-channel --update && doas nixos-rebuild switch && nix-channel --update && home-manager switch && system-changes-report && hm-changes-report && df -h && date";
-      _nix-up =
-        "doas nix-channel --update && doas nixos-rebuild switch && nix-channel --update && home-manager switch && system-changes-report && hm-changes-report && df -h && date";
-      home-up =
-        "git -C ~/dotfiles pull && nix-channel --update && home-manager switch && hm-changes-report";
-      _home-up =
-        "nix-channel --update && home-manager switch && hm-changes-report";
-      nix-hammer =
-        "nix shell -f https://github.com/jtojnar/nixpkgs-hammering/archive/master.tar.gz -c nixpkgs-hammer";
-
-      fb =
-        "fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'";
+      upgrade_emacs = ''cp ~/.emacs.d/straight/versions/default.el ~/straight-versions-default-`date "+%Y-%m-%d-%H%M%S"`.el && emacs --batch -l "~/.emacs.d/init.el" -f "my/upgrade-packages"'';
+      diff_emacs = "difft --color always --context 0 $(ls -d1v ~/straight-versions-default-*.el | tail -1) ~/.emacs.d/straight/versions/default.el | grep '\\[9[12]' | egrep -v '(gnu-elpa-mirror|nongnu-elpa|melpa|emacsmirror-mirror)'";
+
+      nix-up = "git -C ~/dotfiles pull && doas nix-channel --update && doas nixos-rebuild switch && nix-channel --update && home-manager switch && system-changes-report && hm-changes-report && df -h && date";
+      _nix-up = "doas nix-channel --update && doas nixos-rebuild switch && nix-channel --update && home-manager switch && system-changes-report && hm-changes-report && df -h && date";
+      home-up = "git -C ~/dotfiles pull && nix-channel --update && home-manager switch && hm-changes-report";
+      _home-up = "nix-channel --update && home-manager switch && hm-changes-report";
+      nix-hammer = "nix shell -f https://github.com/jtojnar/nixpkgs-hammering/archive/master.tar.gz -c nixpkgs-hammer";
+
+      fb = "fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'";
 
       zz = "z $PWD";
 
@@ -77,8 +83,7 @@ in {
       erg = "ea run grouped rg --";
       fd = "ea run linear fd --";
 
-      git-reset-branch =
-        "git fetch && git reset --hard origin/$(git branch --show-current)";
+      git-reset-branch = "git fetch && git reset --hard origin/$(git branch --show-current)";
 
       # Git log aliases from the omz git plugin
       gl = "git pull";
@@ -88,27 +93,23 @@ in {
       glgga = "git log --graph --decorate --all";
       glgm = "git log --graph --max-count=10";
       glo_ = "git log --oneline --decorate";
-      glol = ''
-        git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset"'';
-      glols = ''
-        git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --stat'';
-      glod = ''
-        git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset"'';
-      glods = ''
-        git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset" --date=short'';
-      glola = ''
-        git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --all'';
+      glol = ''git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset"'';
+      glols = ''git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --stat'';
+      glod = ''git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset"'';
+      glods = ''git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset" --date=short'';
+      glola = ''git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --all'';
       glog = "git log --oneline --decorate --graph";
       gloga = "git log --oneline --decorate --graph --all";
-    } // optionalAttrs pkgs.stdenv.isDarwin {
-      oemacs = "open -a /Applications/Emacs.app";
-    };
+    } // optionalAttrs pkgs.stdenv.isDarwin { oemacs = "open -a /Applications/Emacs.app"; };
 
     localVariables = {
       PER_DIRECTORY_HISTORY_TOGGLE = "^\\\\"; # ^\\ is ^#
       HISTORY_START_WITH_GLOBAL = true;
 
-      ZSH_AUTOSUGGEST_STRATEGY = [ "history" "completion" ];
+      ZSH_AUTOSUGGEST_STRATEGY = [
+        "history"
+        "completion"
+      ];
 
       NVM_AUTO_USE = true;
       NVM_LAZY_LOAD = true;
@@ -116,15 +117,11 @@ in {
       LSP_USE_PLISTS = true;
       LESS = "-iRXF";
 
-      FZF_DEFAULT_COMMAND = ''
-        rg --files --no-ignore --hidden --follow -g \"!{.git,node_modules}/*\" 2> /dev/null'';
-      FZF_CTRL_T_COMMAND =
-        config.programs.zsh.localVariables.FZF_DEFAULT_COMMAND;
-      FZF_ALT_C_COMMAND = ''
-        rg --hidden --files --sort-files --null -g \"!{.git,node_modules}/*\" | xargs -0 dirname | sort -u'';
+      FZF_DEFAULT_COMMAND = ''rg --files --no-ignore --hidden --follow -g \"!{.git,node_modules}/*\" 2> /dev/null'';
+      FZF_CTRL_T_COMMAND = config.programs.zsh.localVariables.FZF_DEFAULT_COMMAND;
+      FZF_ALT_C_COMMAND = ''rg --hidden --files --sort-files --null -g \"!{.git,node_modules}/*\" | xargs -0 dirname | sort -u'';
       FZF_ALT_C_OPTS = "--preview 'eza --tree {} | head -200'";
-      FZF_CTRL_R_OPTS =
-        "--preview 'echo {}' --preview-window down:3:hidden:wrap --bind 'ctrl-t:toggle-preview'";
+      FZF_CTRL_R_OPTS = "--preview 'echo {}' --preview-window down:3:hidden:wrap --bind 'ctrl-t:toggle-preview'";
       FZF_DEFAULT_OPTS = "--bind=ctrl-t:toggle-all --bind=ctrl-j:jump";
     };
     initExtraFirst = ''
@@ -284,7 +281,8 @@ in {
       [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
     '';
 
-    plugins = with pkgs;
+    plugins =
+      with pkgs;
       [
         {
           name = "zsh-autopair";
@@ -314,8 +312,7 @@ in {
         {
           name = "zsh-history-substring-search";
           src = zsh-history-substring-search;
-          file =
-            "share/zsh-history-substring-search/zsh-history-substring-search.zsh";
+          file = "share/zsh-history-substring-search/zsh-history-substring-search.zsh";
         }
         {
           name = "zsh-forgit";
@@ -342,16 +339,18 @@ in {
           };
           file = "per-directory-history.zsh";
         }
-      ] ++ optionals stdenv.isDarwin [{
-        name = "zsh-nvm";
-        src = fetchFromGitHub {
-          owner = "lukechilds";
-          repo = "zsh-nvm";
-          rev = "23067bd9bb6eb6f4737a3ea90cb0cb5e85f61ba2";
-          sha256 = "Zwdi7bezMFKaIKYwsSftu3mJSFvadEWmY2hYnU1Kpu4=";
-        };
-        file = "zsh-nvm.plugin.zsh";
-      }];
+      ]
+      ++ optionals stdenv.isDarwin [
+        {
+          name = "zsh-nvm";
+          src = fetchFromGitHub {
+            owner = "lukechilds";
+            repo = "zsh-nvm";
+            rev = "23067bd9bb6eb6f4737a3ea90cb0cb5e85f61ba2";
+            sha256 = "Zwdi7bezMFKaIKYwsSftu3mJSFvadEWmY2hYnU1Kpu4=";
+          };
+          file = "zsh-nvm.plugin.zsh";
+        }
+      ];
   };
 }
-