nix-config/home/zsh.nix

77 lines
1.8 KiB
Nix

{ pkgs, ... }:
{
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
# History
history = {
size = 10000;
save = 10000;
ignoreDups = true;
share = true;
extended = true;
};
# Pure prompt
plugins = [
{
name = "pure";
src = pkgs.fetchFromGitHub {
owner = "sindresorhus";
repo = "pure";
rev = "v1.23.0";
sha256 = "sha256-BmQO4xqd/3QnpLUitD2obVxL0UulpboT8jGNEh4ri8k=";
};
}
{
name = "zsh-syntax-highlighting";
file = "share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh";
src = pkgs.zsh-syntax-highlighting;
}
{
name = "zsh-autosuggestions";
file = "share/zsh-autosuggestions/zsh-autosuggestions.zsh";
src = pkgs.zsh-autosuggestions;
}
];
# Base aliases (universal)
shellAliases = {
ll = "eza -l --icons --git";
la = "eza -la --icons --git";
ff = "fastfetch";
};
# Environment setup BEFORE everything else (fixes PATH issues)
envExtra = ''
if [ -x "/opt/homebrew/bin/brew" ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
'';
# Init content - runs on shell start (after PATH is set)
initExtra = ''
# Show fastfetch on shell start
echo
fastfetch
echo
# Load pure prompt
autoload -U promptinit; promptinit
prompt pure
# Right prompt - time in gray
RPROMPT='%F{240}%D{%H:%M:%S}%f'
# Pure prompt customization
zstyle ':prompt:pure:prompt:success' color green
zstyle ':prompt:pure:prompt:success' symbol ">"
zstyle ':prompt:pure:prompt:error' color red
zstyle ':prompt:pure:prompt:error' symbol ">"
'';
};
}