{ pkgs, config, ... }: let component = name: builtins.readFile (builtins.toString ../../config/zsh/components + "/${name}.zsh"); snippets = map component [ "console-256color" "fuzzy-tab" "magic-space" "navigation" ] ++ [ "source ${pkgs.fzf}/share/fzf/key-bindings.zsh" "ZSH_HIGHLIGHT_DIRS_BLACKLIST=(/* /ipfs /ipns)" '' command_not_found_handler() { ${pkgs.comma}/bin/comma "$@" } '' ]; in { environment.shellAliases = { cat = "bat"; df = "duf"; doas = "doas "; du = "dua"; ip = "ip -c"; ls = "lsd"; sudo = "sudo "; tree = "lsd --tree"; uctl = "systemctl --user"; vim = "hx"; nix-repl = "nix repl ''"; # thanks gytis manix-view = ''manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --ansi --preview="manix '{}' | sed 's/type: /> type: /g' | bat -l Markdown --color=always --plain"''; }; programs = { command-not-found.enable = false; zsh = { enable = true; histFile = "$HOME/.cache/zsh_history"; histSize = 15000; setOptions = [ "autocd" "autopushd" "globcomplete" "globstarshort" "histexpiredupsfirst" "histfcntllock" "histignoredups" "histnofunctions" "histnostore" "histreduceblanks" "histverify" "interactivecomments" "monitor" "nobadpattern" "nonomatch" "promptsubst" "sharehistory" "zle" ]; vteIntegration = true; promptInit = builtins.readFile ../../config/zsh/prompt.zsh; interactiveShellInit = builtins.concatStringsSep "\n" snippets; enableCompletion = true; autosuggestions.enable = true; syntaxHighlighting = { enable = true; highlighters = [ "main" "pattern" ]; styles = { "precommand" = "fg=33"; "arg0" = "fg=39"; "single-hyphen-option" = "fg=229"; "double-hyphen-option" = "fg=228"; "path" = "none"; }; # these are aliases, highlight them properly regardless patterns = { "doas" = "fg=33"; "sudo" = "fg=33"; }; }; }; }; }