summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--user/modules/zsh.nix68
-rw-r--r--user/zsh/.config/zsh/.zshenv69
-rw-r--r--user/zsh/.config/zsh/.zshrc13
-rw-r--r--user/zsh/.zshenv3
4 files changed, 67 insertions, 86 deletions
diff --git a/user/modules/zsh.nix b/user/modules/zsh.nix
index be545635..9ace6f75 100644
--- a/user/modules/zsh.nix
+++ b/user/modules/zsh.nix
@@ -3,7 +3,6 @@
 {
   home.file = {
     ".rm_recycle_home".text = ""; # use trash automatically in home directory
-    ".zshenv".text = builtins.readFile ../zsh/.zshenv;
   };
   home.packages = with pkgs; [
     fzf
@@ -17,4 +16,71 @@
     recursive = true;
     source = ../zsh/.config/zsh;
   };
+
+  programs.zsh = {
+    enable = true;
+
+    enableAutosuggestions = true;
+    enableCompletion = true;
+    defaultKeymap = "emacs";
+
+    dotDir = ".config/zsh";
+
+    history = {
+      expireDuplicatesFirst = true;
+      extended = true;
+      path = ".cache/zsh/history";
+      save = 20000;
+      size = 10000;
+    };
+
+    localVariables = {
+      ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=7";
+    };
+
+    # move to envExtra after 19.09
+    initExtra = ''
+      case $OSTYPE in
+        darwin*)
+          os=darwin
+          ;;
+        linux-gnu)
+          os=linux
+          ;;
+        freebsd*)
+          os=freebsd
+          ;;
+        *)
+          os=unknown
+          ;;
+      esac
+
+      case $MACHTYPE in
+        *64)
+          arch=amd64
+          ;;
+        *)
+          arch=386
+          ;;
+      esac
+      if [[ ''${path[(I)$HOME/.local/bin ]} ]]
+      then
+        path+=($HOME/.local/bin)
+      fi
+
+      if [[ ''${path[(I)$HOME/go/bin ]} ]]
+      then
+        path+=($HOME/go/bin)
+      fi
+
+      if [[ $HOST =~ satoshi ]]
+      then
+        EMAIL=alan@satoshipay.io
+      else
+        EMAIL=alan@alanpearce.eu
+      fi
+
+      export GHQ_ROOT="$HOME/projects:$HOME/go/src:$HOME/quicklisp/local-projects"
+    '' + builtins.readFile ../zsh/.config/zsh/.zshrc;
+  };
 }
diff --git a/user/zsh/.config/zsh/.zshenv b/user/zsh/.config/zsh/.zshenv
deleted file mode 100644
index 2f8e5bab..00000000
--- a/user/zsh/.config/zsh/.zshenv
+++ /dev/null
@@ -1,69 +0,0 @@
-if [[ $SHLVL -eq 1 || -n $DISPLAY ]]
-then
-  if [[ -f $ZDOTDIR/zshenv.local ]]
-  then
-    . $ZDOTDIR/zshenv.local
-  fi
-
-  if [[ -f $ZDOTDIR/zshenv.private ]]
-  then
-    . $ZDOTDIR/zshenv.private
-  fi
-
-  if [[ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]]
-  then
-    . $HOME/.nix-profile/etc/profile.d/nix.sh;
-    export NIX_LINK
-  fi
-
-  if [[ -e $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh ]]
-  then
-    . $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
-  fi
-
-  case $OSTYPE in
-    darwin*)
-      os=darwin
-      ;;
-    linux-gnu)
-      os=linux
-      ;;
-    freebsd*)
-      os=freebsd
-      ;;
-    *)
-      os=unknown
-      ;;
-  esac
-
-  case $MACHTYPE in
-    *64)
-      arch=amd64
-      ;;
-    *)
-      arch=386
-      ;;
-  esac
-
-  if [[ ${path[(I)$HOME/.local/bin ]} ]]
-  then
-    path+=($HOME/.local/bin)
-  fi
-
-  if [[ ${path[(I)$HOME/go/bin ]} ]]
-  then
-    path+=($HOME/go/bin)
-  fi
-
-  if [[ $HOST =~ satoshi ]]
-  then
-    EMAIL=alan@satoshipay.io
-  else
-    EMAIL=alan@alanpearce.eu
-  fi
-
-  export GTAGSCONF=~/.globalrc
-  export GTAGSLABEL=ctags
-
-  export GHQ_ROOT="$HOME/projects:$HOME/go/src:$HOME/quicklisp/local-projects"
-fi
diff --git a/user/zsh/.config/zsh/.zshrc b/user/zsh/.config/zsh/.zshrc
index 2d869f0e..f59187f1 100644
--- a/user/zsh/.config/zsh/.zshrc
+++ b/user/zsh/.config/zsh/.zshrc
@@ -11,14 +11,6 @@ source $HOME/.zplugin/bin/zplugin.zsh
 autoload -Uz _zplugin
 (( ${+_comps} )) && _comps[zplugin]=_zplugin
 
-HISTSIZE=10000
-SAVEHIST=20000
-HISTFILE=${XDG_CACHE_HOME:=$HOME/.cache}/zsh/history
-[[ -d ${HISTFILE:h} ]] || mkdir -p ${HISTFILE:h}
-setopt extended_history
-setopt hist_save_no_dups
-setopt hist_ignore_space
-unsetopt share_history
 setopt inc_append_history_time
 setopt transient_rprompt
 
@@ -80,7 +72,6 @@ alias tsnode="pnpx ts-node"
 alias wprop="xprop | egrep '^WM_(CLASS|NAME|WINDOW_ROLE|TYPE)'"
 zmodload zsh/terminfo
 
-bindkey -e
 bindkey '\e[3~' delete-char
 
 bindkey '\C-hd' describe-key-briefly
@@ -152,10 +143,6 @@ zplugin load "mollifier/cd-gitroot"
 zplugin ice wait'[[ -n ${ZLAST_COMMANDS[(r)rm*]} ]]' lucid
 zplugin load "MikeDacre/careful_rm"
 
-ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=7"
-zplugin ice wait'1' lucid if'[[ -z $SSH_CLIENT ]]'
-zplugin load "zsh-users/zsh-autosuggestions"
-
 zplugin ice wait'1' lucid
 zplugin load "arzzen/calc.plugin.zsh"
 
diff --git a/user/zsh/.zshenv b/user/zsh/.zshenv
deleted file mode 100644
index 354c54da..00000000
--- a/user/zsh/.zshenv
+++ /dev/null
@@ -1,3 +0,0 @@
-ZDOTDIR="${XDG_CONFIG_HOME:=$HOME/.config}/zsh"
-
-source "$ZDOTDIR"/.zshenv