nix-config/home/zsh.nix

98 lines
2.6 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ pkgs, lib, ... }:
{
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
# History - disabled, using atuin instead
history = {
size = 1000; # держим в памяти для текущей сессии
save = 0; # не сохраняем в файл
ignoreDups = true;
share = false; # atuin сам разберётся с sync
extended = false;
};
# 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";
# gita (manage multiple git repos)
gll = "gita ll";
gllg = "gita ll -g";
gadd = "gita add";
gstatus = "gita status";
gfetch = "gita fetch";
gremote = "gita remote";
ginfo = "gita info";
gll-all = "gita ll -g";
# pass sync (password store)
pass-sync = "pass git push";
pass-pull = "pass git pull";
pass-status = "pass git status";
pass-sync-forgejo = "pass git push origin";
pass-sync-github = "pass git push github";
pass-sync-solmoe = "pass git push git.sol.moe";
pass-pull-all = "pass git pull --all";
};
# Environment setup (zshenv)
envExtra = ''
if [ -x "/opt/homebrew/bin/brew" ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
'';
# Init content
initContent = lib.mkMerge [
''
# 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 ">"
''
];
};
}