feat: add zsh

Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
This commit is contained in:
Lander Van den Bulcke 2024-08-28 16:41:33 +02:00
parent 67e8493e20
commit 15b7ee52ce
Signed by: lander
GPG key ID: 0142722B4B0C536F
2 changed files with 99 additions and 0 deletions

View file

@ -9,6 +9,7 @@
inputs.catppuccin.homeManagerModules.catppuccin
./git
./zsh.nix
];
home = {

View file

@ -0,0 +1,98 @@
{
programs = {
zsh = {
enable = true;
dotDir = ".config/zsh";
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting = {
enable = true;
catppuccin.enable = true;
};
history = {
save = 10000;
size = 10000;
path = "$HOME/.cache/zsh_history";
};
initExtra = ''
bindkey '^[[1;5C' forward-word # Ctrl+RightArrow
bindkey '^[[1;5D' backward-word # Ctrl+LeftArrow
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric
zstyle ':completion:*' menu select
zstyle ':completion:*' list-colors "''${(s.:.)LS_COLORS}"
# HACK! Simple shell function to patch ruff bins downloaded by tox from PyPI to use
# the ruff included in NixOS - needs to be run each time the tox enviroment is
# recreated
patch_tox_ruff() {
for x in $(find .tox -name ruff -type f -print); do
rm $x;
ln -sf $(which ruff) $x;
done
}
clean-crafts-lxc() {
for CRAFT in snapcraft rockcraft charmcraft; do
lxc --project $CRAFT list -fcsv -cn | xargs lxc --project $CRAFT delete -f >/dev/null
done
}
export EDITOR=vim
'';
shellAliases = {
ls = "eza -gl --git --color=automatic";
tree = "eza --tree";
cat = "bat";
ip = "ip --color";
ipb = "ip --color --brief";
gac = "git add -A && git commit -a";
gp = "git push";
gst = "git status -sb";
htop = "btm -b";
neofetch = "fastfetch";
tf = "terraform";
tfi = "terraform init";
tfp = "terraform plan";
tfa = "terraform apply -auto-approve";
tfd = "terraform destroy -auto-approve";
tfo = "terraform output -json";
wgu = "sudo wg-quick up";
wgd = "sudo wg-quick down";
ts = "tailscale";
tst = "tailscale status";
tsu = "tailscale up --ssh --operator=$USER";
tsd = "tailscale down";
js = "juju status";
jsw = "juju status --watch 1s --color";
jsrw = "juju status --watch 1s --color --relations";
jdl = "juju debug-log";
open = "xdg-open";
k = "kubectl";
opget = "op item get \"$(op item list --format=json | jq -r '.[].title' | fzf)\"";
speedtest = "curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -";
cleanup-nix = "nh clean all --keep-since 10d --keep 3";
rln = "nh os switch /home/lander/git/nixos-config";
rlh = "nh home switch /home/lander/git/nixos-config";
rlb = "rln;rlh";
};
};
};
}