mirror of
https://git.sr.ht/~rouven/nixos-config
synced 2025-04-25 16:08:30 +02:00
global zsh config
This commit is contained in:
parent
82b62d2cae
commit
1737739b73
10 changed files with 73 additions and 107 deletions
|
@ -1,12 +0,0 @@
|
|||
{ ... }:
|
||||
{
|
||||
programs.bash.shellInit = ''
|
||||
download_nixpkgs_cache_index () {
|
||||
filename="index-$(uname -m)-$(uname | tr A-Z a-z)"
|
||||
mkdir -p ~/.cache/nix-index && cd ~/.cache/nix-index
|
||||
# -N will only download a new version if there is an update.
|
||||
wget -q -N https://github.com/Mic92/nix-index-database/releases/latest/download/$filename
|
||||
ln -f $filename files
|
||||
}
|
||||
'';
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./bash.nix
|
||||
./caches.nix
|
||||
./gpg.nix
|
||||
./sops.nix
|
||||
./vim.nix
|
||||
./zsh.nix
|
||||
];
|
||||
}
|
||||
|
|
59
shared/zsh.nix
Normal file
59
shared/zsh.nix
Normal file
|
@ -0,0 +1,59 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.command-not-found.enable = false;
|
||||
users.defaultUserShell = pkgs.zsh;
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
shellAliases = {
|
||||
rm = "trash";
|
||||
ls = "exa --icons";
|
||||
l = "ls -l";
|
||||
ll = "ls -la";
|
||||
la = "ls -a";
|
||||
switch = "sudo nixos-rebuild switch && cat ${../images/another-cat-2.sixel}";
|
||||
update = "cd /etc/nixos && nix flake update && cat ${../images/another-cat.sixel}";
|
||||
garbage = "sudo nix-collect-garbage -d && cat ${../images/cat-garbage.sixel}";
|
||||
q = "exit";
|
||||
};
|
||||
histSize = 100000;
|
||||
histFile = "~/.local/share/zsh/history";
|
||||
autosuggestions = {
|
||||
enable = true;
|
||||
highlightStyle = "fg=#00bbbb,bold";
|
||||
};
|
||||
|
||||
ohMyZsh = {
|
||||
enable = true;
|
||||
plugins = [ "gh" ];
|
||||
theme = "agnoster";
|
||||
};
|
||||
|
||||
shellInit =
|
||||
''
|
||||
source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh
|
||||
|
||||
function c() {
|
||||
if [ $# -eq 0 ]; then
|
||||
cd $(find -maxdepth 4 -not -path '*[cC]ache*' -not -path '*[tT]rash*' -type d | fzf --preview '${pkgs.tree}/bin/tree -C {}')
|
||||
else
|
||||
$1 $(find -maxdepth 5 -not -path '*[cC]ache*' -not -path '*[tT]rash*' | fzf --preview '${pkgs.tree}/bin/tree -C {}')
|
||||
fi
|
||||
}
|
||||
|
||||
function svpn() {
|
||||
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
|
||||
systemctl start $unit
|
||||
else
|
||||
systemctl stop $unit
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_dir() {
|
||||
prompt_segment blue $CURRENT_FG '%c'
|
||||
}
|
||||
cat ${../images/cat.sixel}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue