flake/modules/home/shell/default.nix
2024-03-26 11:39:16 +00:00

137 lines
3.9 KiB
Nix

{
config,
lib,
pkgs,
...
}:
{
home.packages = with pkgs; [comma ripgrep];
home.sessionVariables.STARSHIP_CACHE = "${config.xdg.cacheHome}/starship";
programs = {
nix-index.enable = false;
exa.enable = true;
zoxide = {
enable = true;
enableZshIntegration = true;
};
dircolors = {
enable = true;
enableZshIntegration = true;
};
skim = {
enable = true;
enableZshIntegration = true;
defaultCommand = "rg --files --hidden";
changeDirWidgetOptions = [
"--preview 'exa --icons --git --color always -T -L 3 {} | head -200'"
"--exact"
];
};
starship = {
enable = true;
settings = {
add_newline = true;
scan_timeout = 1;
#character = {
#error_symbol = "[󰊠](bold red)";
#success_symbol = "[󰊠](bold green)";
#vicmd_symbol = "[󰊠](bold yellow)";
#format = "$symbol [|](bold bright-black) ";
#};
git_commit = {commit_hash_length = 4;};
line_break.disabled = false;
lua.symbol = "[](blue) ";
python.symbol = "[](blue) ";
hostname = {
ssh_only = true;
format = "[$hostname](bold blue) ";
disabled = false;
};
};
};
zsh = {
enable = true;
dotDir = ".config/zsh";
enableCompletion = true;
enableAutosuggestions = true;
syntaxHighlighting.enable = true;
initExtra = ''
autoload -U compinit
setopt no_auto_remove_slash
fuck () {
TF_PYTHONIOENCODING=$PYTHONIOENCODING;
export TF_SHELL=zsh;
export TF_ALIAS=fuck;
TF_SHELL_ALIASES=$(alias);
export TF_SHELL_ALIASES;
TF_HISTORY="$(fc -ln -10)";
export TF_HISTORY;
export PYTHONIOENCODING=utf-8;
TF_CMD=$(
thefuck THEFUCK_ARGUMENT_PLACEHOLDER $@
) && eval $TF_CMD;
unset TF_HISTORY;
export PYTHONIOENCODING=$TF_PYTHONIOENCODING;
test -n "$TF_CMD" && print -s $TF_CMD
}
'';
history = {
save = 2000000;
size = 2000000;
expireDuplicatesFirst = true;
ignoreDups = true;
ignoreSpace = true;
path = "$HOME/.local/state/zsh/history";
};
shellAliases = with pkgs; with lib; {
rebuild = "doas nix-store --verify; pushd ~/.config/dotfiles && doas nixos-rebuild switch --flake .# && notify-send \"Done\" && bat cache --build; popd";
update = "doas nix-store --verify; pushd ~/.config/dotfiles && doas nixos-rebuild switch --upgrade-all --flake .# && notify-send \"Done\" && bat cache --build; popd";
cleanup = "doas nix-collect-garbage --delete-older-than 7d";
bloat = "nix path-info -Sh /run/current-system";
cat = "${getExe bat} --style=plain";
vpn = getExe mullvad;
grep = getExe ripgrep;
fzf = getExe skim;
MANPAGER = "sh -c 'col -bx | bat -l man -p'";
du = getExe du-dust;
ps = getExe procs;
m = "mkdir -p";
fcd = "cd $(find -type d | fzf)";
l = "ls -lF --time-style=long-iso --icons";
sc = "sudo systemctl";
scu = "systemctl --user ";
la = "${getExe exa} -lah";
ls = "${getExe exa} -h --git --icons --color=auto --group-directories-first -s extension";
tree = "${getExe exa} --tree --icons --tree";
burn = "pkill -9";
diff = "diff --color=auto";
".." = "cd ..";
"..." = "cd ../../";
"...." = "cd ../../../";
"....." = "cd ../../../../";
"......" = "cd ../../../../../";
v = "${getExe neovim}";
vim = "${getExe neovim}";
};
plugins = with pkgs; [
{
name = "zsh-vi-mode";
src = zsh-vi-mode;
file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh";
}
];
};
};
}