diff --git a/nix/home-manager/modules/packages/zsh.nix b/nix/home-manager/modules/packages/zsh.nix index 6385d75..0b96861 100644 --- a/nix/home-manager/modules/packages/zsh.nix +++ b/nix/home-manager/modules/packages/zsh.nix @@ -9,26 +9,69 @@ in { programs.zsh = { enable = true; initExtraFirst = '' - autoload -Uz up-line-or-beginning-search down-line-or-beginning-search zmv colors add-zle-hook-widget + autoload -Uz up-line-or-beginning-search down-line-or-beginning-search zmv colors add-zle-hook-widget compinit + compinit zle -N up-line-or-beginning-search zle -N down-line-or-beginning-search + export ZSH_CACHE_DIR="$HOME/.cache/zsh" ''; initExtra = builtins.readFile ../../../../zsh/zshrc; - # antidote = { - # enable = true; - # plugins = [ - # "zdharma-continuum/fast-syntax-highlighting" - # "zsh-users/zsh-completions" - # "b4b4r07/zsh-vimode-visual" - # "ohmyzsh/oh-my-zsh" - # ]; - # useFriendlyNames = true; - # }; + antidote = { + enable = true; + plugins = let + ohmyzsh-lib = "ohmyzsh/oh-my-zsh path:lib"; + ohmyzsh-plugin = "ohmyzsh/oh-my-zsh path:plugins"; + extraPlugins = + if isLinux + then [] + else if isDarwin + then [ + "${ohmyzsh-plugin}/brew" + ] + else []; + in + extraPlugins + ++ [ + "zdharma-continuum/fast-syntax-highlighting" + "zsh-users/zsh-completions" + "b4b4r07/zsh-vimode-visual" + "${ohmyzsh-lib}/completion.zsh" + "${ohmyzsh-lib}/git.zsh" + "${ohmyzsh-plugin}/1password" + "${ohmyzsh-plugin}/aws" + "${ohmyzsh-plugin}/colored-man-pages" + "${ohmyzsh-plugin}/docker" + "${ohmyzsh-plugin}/docker-compose" + "${ohmyzsh-plugin}/emoji" + "${ohmyzsh-plugin}/fd kind:fpath" + "${ohmyzsh-plugin}/gh" + "${ohmyzsh-plugin}/git" + "${ohmyzsh-plugin}/gitignore" + "${ohmyzsh-plugin}/gradle" + "${ohmyzsh-plugin}/helm" + "${ohmyzsh-plugin}/isodate" + "${ohmyzsh-plugin}/mix-fast" + "${ohmyzsh-plugin}/mosh" + "${ohmyzsh-plugin}/mvn" + "${ohmyzsh-plugin}/nmap" + "${ohmyzsh-plugin}/rsync" + "${ohmyzsh-plugin}/rust" + ]; + useFriendlyNames = true; + }; dirHashes = { "-- -dotfiles" = "$HOME/.dotfiles"; "-- -src" = "$HOME/src"; "-- -doom" = "$HOME/.emacs.d"; }; + autocd = false; + history = { + path = "$HOME/.histfile"; + size = 10000; + save = 10000; + ignoreAllDups = true; + ignoreSpace = true; + }; sessionVariables = { COMPLETION_WAITING_DOTS = true; VISUAL = "nvim"; diff --git a/zsh/zshrc b/zsh/zshrc index e427396..e0062ec 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -1,8 +1,5 @@ -HISTFILE=~/.histfile -HISTSIZE=10000 -SAVEHIST=10000 -setopt extendedglob nomatch notify histignorespace histignorealldups histnofunctions histnostore histverify incappendhistory autopushd pushdignoredups -unsetopt autocd beep +setopt extendedglob nomatch notify histnofunctions histnostore histverify incappendhistory autopushd pushdignoredups +unsetopt beep if [[ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]]; then @@ -38,47 +35,10 @@ zstyle ":completion:*" substitute 1 path=("$HOME/bin" "$HOME/go/bin" $path) -local ZSH_PLUGIN_DIR="$HOME/.zsh_plugins" -zstyle ':znap:*' repos-dir "${ZSH_PLUGIN_DIR}" -zstyle ':znap:*' auto-compile no -zstyle ':znap:*:*' git-maintenance off -autoload -Uz add-zle-hook-widget - -if [[ ! -d "${ZSH_PLUGIN_DIR}/zsh-snap" ]]; then - mkdir -p ~/.zsh_plugins - cd ~/.zsh_plugins - git clone https://github.com/marlonrichert/zsh-snap.git -fi -source "${ZSH_PLUGIN_DIR}/zsh-snap/znap.zsh" && export ZNAP_USED=1 - -local -a paths -for line in "${(@f)"$(<~/.zsh_plugins.txt)"}" -{ - if [[ ! -d "${ZSH_PLUGIN_DIR}/$(basename $line)" ]]; then - paths=($paths $line) - fi -} - -if [[ ! ${#paths[@]} -eq 0 ]]; then - echo "Paths not empty: $paths" - znap clone ${^paths} -fi - -if [[ ( $ZNAP_USED = 1 ) ]]; then - znap source oh-my-zsh lib/{git,completion} - znap source oh-my-zsh plugins/colored-man-pages - fpath=($fpath ~[oh-my-zsh]/plugins/{pass,ripgrep,cargo,docker,docker-compose,rsync,fd}) - znap source fast-syntax-highlighting - fpath=($fpath ~[zsh-completions]/src) - znap source zsh-vimode-visual -fi - if [[ -d ~/.cargo/bin ]]; then path=($path $HOME/.cargo/bin) fi -znap source oh-my-zsh plugins/{gitignore,git,helm,mvn,gradle} - function dt() { local session_name session_name=${1:-DefaultSession}