|  | 
| 9 | 9 |     enable = true; | 
| 10 | 10 |     dotDir = "${config.xdg.configHome}/zsh"; | 
| 11 | 11 |     zprof.enable = false; | 
| 12 |  | -    enableCompletion = false; | 
|  | 12 | +    enableCompletion = true; | 
|  | 13 | +    completionInit = '' | 
|  | 14 | +      autoload -U compinit | 
|  | 15 | +      compinit -d "$XDG_CACHE_HOME/zsh/zcompdump" | 
|  | 16 | +    ''; | 
| 13 | 17 |     enableVteIntegration = if pkgs.stdenv.isDarwin then false else true; | 
| 14 | 18 |     defaultKeymap = "viins"; | 
|  | 19 | +    dirHashes = { | 
|  | 20 | +      # enter hashdir via `cd ~XXX` | 
|  | 21 | +      work = "${config.home.homeDirectory}/Work"; | 
|  | 22 | +      Work = "${config.home.homeDirectory}/Work"; | 
|  | 23 | +      ssh = "${config.home.homeDirectory}/.ssh"; | 
|  | 24 | +      music = "${config.home.homeDirectory}/Music"; | 
|  | 25 | +      pic = "${config.home.homeDirectory}/Pictures"; | 
|  | 26 | +      dl = "${config.home.homeDirectory}/Downloads"; | 
|  | 27 | +      doc = "${config.home.homeDirectory}/Documents"; | 
|  | 28 | +      cfg = "${config.xdg.configHome}"; | 
|  | 29 | +      config = "${config.xdg.configHome}"; | 
|  | 30 | +      share = "${config.xdg.dataHome}"; | 
|  | 31 | +      state = "${config.xdg.stateHome}"; | 
|  | 32 | +      cache = "${config.xdg.cacheHome}"; | 
|  | 33 | +    }; | 
|  | 34 | +    cdpath = [ | 
|  | 35 | +      # autocompletion after `cd` | 
|  | 36 | +      "${config.xdg.configHome}/nvim" | 
|  | 37 | +      "${config.xdg.configHome}/home-manager" | 
|  | 38 | +    ]; | 
|  | 39 | +    history = { | 
|  | 40 | +      path = "${config.xdg.cacheHome}/zsh/history"; | 
|  | 41 | +      size = 20000; # Set session history size. | 
|  | 42 | +      save = 100000; # Set history file size. | 
|  | 43 | +      append = false; | 
|  | 44 | +      extended = true; # Save timestamp into the history file. | 
|  | 45 | +      share = false; # Share command history between zsh sessions | 
|  | 46 | +      saveNoDups = true; | 
|  | 47 | +      ignoreDups = true; | 
|  | 48 | +      ignoreAllDups = true; | 
|  | 49 | +      findNoDups = true; | 
|  | 50 | +      expireDuplicatesFirst = true; | 
|  | 51 | +      ignoreSpace = true; # Do not enter command lines into the history list if the first character is a space. | 
|  | 52 | +      # ignorePatterns = [ | 
|  | 53 | +      #   "rm *" | 
|  | 54 | +      #   "pkill *" | 
|  | 55 | +      # ]; | 
|  | 56 | +    }; | 
|  | 57 | +    setOptions = [ | 
|  | 58 | +      "NO_beep" | 
|  | 59 | +      # ===== History Extra | 
|  | 60 | +      # Let histfile managed by system's `fcntl` call to improve better performance and avoid corruption | 
|  | 61 | +      "hist_fcntl_lock" | 
|  | 62 | +      # Add comamnds as they are typed, don't wait until shell exit | 
|  | 63 | +      "inc_append_history" | 
|  | 64 | +      # Add EXTENDED_HISTORY format for INC_APPEND_HISTORY | 
|  | 65 | +      "inc_append_history_time" | 
|  | 66 | +      # Remove extra blanks from each command line being added to history | 
|  | 67 | +      "hist_reduce_blanks" | 
|  | 68 | +      # Do not execute immediately upon history expansion. | 
|  | 69 | +      "hist_verify" | 
|  | 70 | +      # Don't beep when accessing non-existent history. | 
|  | 71 | +      "NO_hist_beep" | 
|  | 72 | +      # ===== Prompt | 
|  | 73 | +      # Expand parameters in prompt variables. | 
|  | 74 | +      "prompt_subst" | 
|  | 75 | +    ]; | 
| 15 | 76 |     antidote = { | 
| 16 | 77 |       enable = true; | 
| 17 | 78 |       useFriendlyNames = true; | 
| 18 |  | -      plugins = [ | 
| 19 |  | -        # lazy-loading `kind:defer` | 
| 20 |  | -        "QuarticCat/zsh-smartcache" # better mroth/evalcache | 
| 21 |  | -        "zsh-users/zsh-completions kind:fpath" | 
| 22 |  | -        "belak/zsh-utils path:completion" | 
| 23 |  | -        # "Aloxaf/fzf-tab kind:defer" # needs to load after `compinit`, but before wrap widgets, such as `zsh-autosuggestions` or `fast-syntax-highlighting` | 
| 24 |  | -        "zsh-users/zsh-autosuggestions kind:defer" | 
| 25 |  | -        "zdharma-continuum/fast-syntax-highlighting kind:defer" # add before zsh-history-substring-search to prevent breaking | 
| 26 |  | -        "zpm-zsh/colorize kind:defer" # Colorize the output of various programs | 
| 27 |  | -        "zpm-zsh/colors" # Enhanced colors for zsh | 
| 28 |  | -        "Freed-Wu/zsh-help" # colorize `XXX --help` | 
| 29 |  | -        "zsh-users/zsh-history-substring-search kind:defer" | 
| 30 |  | -        "MichaelAquilina/zsh-you-should-use kind:defer" | 
| 31 |  | -        # "MichaelAquilina/zsh-autoswitch-virtualenv kind:defer" # Auto-switch python venv, pipenv, poetry | 
| 32 |  | -        "sunlei/zsh-ssh kind:defer" | 
| 33 |  | -      ]; | 
|  | 79 | +      plugins = | 
|  | 80 | +        let | 
|  | 81 | +          commonPlugins = [ | 
|  | 82 | +            # lazy-loading `kind:defer` | 
|  | 83 | +            "QuarticCat/zsh-smartcache" # better mroth/evalcache | 
|  | 84 | +            # "belak/zsh-utils path:completion" | 
|  | 85 | +            # "Aloxaf/fzf-tab kind:defer" # needs to load after `compinit`, but before wrap widgets, such as `zsh-autosuggestions` or `fast-syntax-highlighting` | 
|  | 86 | +            "zsh-users/zsh-autosuggestions kind:defer" | 
|  | 87 | +            "zdharma-continuum/fast-syntax-highlighting kind:defer" # add before zsh-history-substring-search to prevent breaking | 
|  | 88 | +            "zsh-users/zsh-history-substring-search kind:defer" | 
|  | 89 | +            "MichaelAquilina/zsh-you-should-use kind:defer" | 
|  | 90 | +            # "sunlei/zsh-ssh kind:defer" | 
|  | 91 | +          ]; | 
|  | 92 | +          darwinPlugins = | 
|  | 93 | +            if pkgs.stdenv.isDarwin then | 
|  | 94 | +              [ | 
|  | 95 | +                "mattmc3/zephyr path:plugins/homebrew" | 
|  | 96 | +                "mattmc3/zephyr path:plugins/macos" | 
|  | 97 | +              ] | 
|  | 98 | +            else | 
|  | 99 | +              [ ]; | 
|  | 100 | +        in | 
|  | 101 | +        commonPlugins ++ darwinPlugins; | 
| 34 | 102 |     }; | 
| 35 | 103 |     initContent = | 
| 36 | 104 |       let | 
| 37 | 105 |         zshDir = "${src}/conf.d/zsh"; | 
| 38 | 106 |         commonFiles = [ | 
| 39 | 107 |           "completion.zsh" | 
| 40 |  | -          "setopt.zsh" | 
|  | 108 | +          # "setopt.zsh" # set in nix | 
| 41 | 109 |           "exports.zsh" | 
| 42 |  | -          "history.zsh" | 
|  | 110 | +          # "history.zsh" # set in nix | 
| 43 | 111 |           "functions.zsh" | 
| 44 |  | -          "bindkeys.zsh" | 
| 45 | 112 |           "plugins.zsh" | 
| 46 | 113 |           "aliases.zsh" | 
| 47 |  | -          "hashdirs.zsh" | 
|  | 114 | +          # "hashdirs.zsh" # set in nix | 
|  | 115 | +          "bindkeys.zsh" | 
| 48 | 116 |         ]; | 
| 49 | 117 |         darwinFiles = if pkgs.stdenv.isDarwin then [ "macos.zsh" ] else [ ]; | 
| 50 | 118 |         readAll = files: builtins.map (f: builtins.readFile "${zshDir}/${f}") files; | 
|  | 
0 commit comments