nixos-config/users/rouven/modules/zsh/default.nix

79 lines
2.2 KiB
Nix
Raw Normal View History

2022-12-19 19:30:32 +01:00
{ config, pkgs, ... }:
{
programs.zsh = {
enable = true;
shellAliases = {
rm = "trash";
2023-02-25 16:30:02 +01:00
ls = "exa --icons";
2023-02-26 22:50:07 +01:00
l = "ls -l";
ll = "ls -la";
la = "ls -a";
2023-03-18 23:11:46 +01:00
"switch" = "sudo nixos-rebuild switch && cat ${../../../../images/another-cat-2.sixel}";
"update" = "cd /etc/nixos && nix flake update && cat ${../../../../images/another-cat.sixel}";
2023-03-18 23:18:23 +01:00
"garbage" = "sudo nix-collect-garbage -d && cat ${../../../../images/cat-garbage.sixel}";
2022-12-19 19:30:32 +01:00
};
history = {
size = 10000;
path = "${config.xdg.dataHome}/zsh/history";
};
oh-my-zsh = {
enable = true;
2022-12-22 14:04:39 +01:00
plugins = [ "gh" "pass" ];
2022-12-19 19:30:32 +01:00
theme = "agnoster";
};
plugins = [
{
name = "zsh-autosuggestions";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-autosuggestions";
rev = "v0.7.0";
sha256 = "KLUYpUu4DHRumQZ3w59m9aTW6TBKMCXl2UcKi4uMd7w=";
};
}
{
name = "fzf-tab";
src = pkgs.fetchFromGitHub {
owner = "Aloxaf";
repo = "fzf-tab";
rev = "14f66e4d3d0b366552c0412eb08ca9e0f7c797bd";
sha256 = "YkfHPSuSKParz7JidR924CJSuXO6Rk0RZTlxPOBwLJk=";
};
}
];
localVariables = {
COMPLETION_WAITING_DOTS = "true";
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=#00bbbb,bold";
# ZSH_AUTOSUGGEST_STRATEGY="(history completion)";
};
initExtra =
''
function c() {
if [ $# -eq 0 ]; then
cd $(find -maxdepth 4 -not -path '*[cC]ache*' -not -path '*[tT]rash*' -type d | fzf --preview 'tree -C {}')
else
$1 $(find -maxdepth 5 -not -path '*[cC]ache*' -not -path '*[tT]rash*' | fzf --preview 'tree -C {}')
fi
}
2023-02-14 21:50:36 +01:00
function svpn() {
2023-01-03 16:11:38 +01:00
unit=$(systemctl list-unit-files | grep "openconnect\|wg-quick\|wireguard\|openvpn" | cut -d "." -f1 | fzf --preview 'systemctl status {}')
if [ $(systemctl is-active $unit) = "inactive" ]; then
2023-02-14 21:50:36 +01:00
systemctl start $unit
2023-01-03 16:11:38 +01:00
else
2023-02-14 21:50:36 +01:00
systemctl stop $unit
2023-01-03 16:11:38 +01:00
fi
2022-12-19 19:30:32 +01:00
}
2023-02-14 21:50:36 +01:00
2022-12-19 19:30:32 +01:00
prompt_dir() {
prompt_segment blue $CURRENT_FG '%c'
}
2023-02-14 21:50:36 +01:00
cat ${../../../../images/cat.sixel}
2022-12-19 19:30:32 +01:00
'';
};
}