nix-config/home/zsh.nix

80 lines
1.9 KiB
Nix

{ pkgs, lib, ... }:
{
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 (zshenv)
envExtra = ''
if [ -x "/opt/homebrew/bin/brew" ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
'';
# Init content - uses lib.mkBefore to run before home-manager generated code
initContent = lib.mkBefore ''
export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:$PATH"
''
+ ''
# 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 ">"
'';
};
}