{ config, lib, shell_library, system, ... }: let cfg = config.soispha.programs.zsh; homeConfig = config.home-manager.users.soispha; sourceFile = path: "source ${path}\n"; in { options.soispha.programs.zsh = { enable = lib.mkEnableOption "zsh"; }; config.home-manager.users.soispha = lib.mkIf cfg.enable { home.sessionPath = []; programs.zsh = { enable = true; enableCompletion = true; autosuggestion = { enable = true; strategy = []; }; syntaxHighlighting.enable = true; autocd = true; # Must be relative to the users home directory (for whatever reason) # Thus no `${homeConfig.xdg.configHome}` dotDir = ".config/zsh"; # TODO: Remove the whole history and replace it completely with `atuin` <2024-10-21> history = { path = "/dev/null"; # save = 0; # number of lines to save # size = 0; # number of lines to keep # share = false; # share between sessions }; loginExtra = # bash '' setopt AUTO_CD setopt AUTO_PUSHD setopt CHASE_DOTS setopt ALWAYS_TO_END setopt EXTENDED_HISTORY setopt HIST_ALLOW_CLOBBER setopt HIST_VERIFY setopt HIST_FCNTL_LOCK setopt APPEND_HISTORY setopt DVORAK setopt CORRECT setopt PROMPT_SUBST setopt TRANSIENT_RPROMPT # maybe? setopt COMBINING_CHARS setopt VI ''; initExtraFirst = sourceFile ./config/zsh-init.zsh + '' SHELL_LIBRARY_VERSION="2.1.2" source ${shell_library.rawLib.${system}} ''; initExtra = let start = lib.modules.mkBefore ( # NOTE: This must be before the insult, as we otherwise override the previous handler <2024-02-28> sourceFile ./config/command_not_found/command_not_found.sh + sourceFile ./config/command_not_found/command_not_found_insult.sh + sourceFile ./config/custom_cursor.zsh + sourceFile ./config/edit_command_line.zsh + sourceFile ./plugins/zsh-history-substring-search.zsh ); end = lib.modules.mkAfter ( sourceFile ./config/keymaps_start.zsh + sourceFile ./config/keymaps/command.zsh + sourceFile ./config/keymaps/emacs.zsh + sourceFile ./config/keymaps/isearch.zsh + sourceFile ./config/keymaps/vicmd.zsh + sourceFile ./config/keymaps/viins.zsh + sourceFile ./config/keymaps/viopp.zsh + sourceFile ./config/keymaps/visual.zsh + sourceFile ./config/keymaps_end.zsh ); in lib.modules.mkMerge [ start end ]; localVariables = { HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND = "bg=cyan,fg=white"; HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND = "fg=red,underline,standout,bold"; }; shellAliases = { ll = ". ll"; lm = ". lm"; }; }; }; }