make most of the aliases conditional, to prevent a bunch of error messages whenever loading zsh on new servers
This commit is contained in:
parent
3ee8c83b01
commit
b4d198ea69
2 changed files with 78 additions and 22 deletions
|
@ -1,6 +1,13 @@
|
||||||
alias f="$(pay-respects zsh)"
|
if [[ $+commands[pay-respects] ]]; then
|
||||||
alias wtf="navi"
|
alias f="$(pay-respects zsh)"
|
||||||
alias help="navi"
|
fi
|
||||||
|
|
||||||
|
if [[ $+commands[navi] ]]; then
|
||||||
|
eval "$(navi widget zsh)"
|
||||||
|
alias wtf="navi"
|
||||||
|
alias help="navi"
|
||||||
|
fi
|
||||||
|
|
||||||
alias rzsh="source ~/.zshrc && echo 'Successfully reloaded zsh!'"
|
alias rzsh="source ~/.zshrc && echo 'Successfully reloaded zsh!'"
|
||||||
alias aliases="${EDITOR} $ZSH_CUSTOM/aliases.zsh && rzsh"
|
alias aliases="${EDITOR} $ZSH_CUSTOM/aliases.zsh && rzsh"
|
||||||
alias zshrc="${EDITOR} ~/.zshrc && rzsh"
|
alias zshrc="${EDITOR} ~/.zshrc && rzsh"
|
||||||
|
@ -10,29 +17,79 @@ alias ohmyzsh="${EDITOR} ~/.oh-my-zsh && rzsh"
|
||||||
alias vi="${EDITOR}"
|
alias vi="${EDITOR}"
|
||||||
alias vim="${EDITOR}"
|
alias vim="${EDITOR}"
|
||||||
alias nano="${EDITOR}"
|
alias nano="${EDITOR}"
|
||||||
alias neofetch="fastfetch"
|
|
||||||
alias nf="fastfetch"
|
if [[ $+commands[fastfetch] ]]; then
|
||||||
alias ff="fastfetch"
|
alias neofetch="fastfetch"
|
||||||
alias uf="uwufetch"
|
alias nf="fastfetch"
|
||||||
alias aur="yay"
|
alias ff="fastfetch"
|
||||||
# this lists packages installed with pacman by size in mebibytes
|
fi
|
||||||
alias pacsize="pacman -Qi | egrep '^(Name|Installed)' | cut -f2 -d':' | paste - - | column -t | sort -nrk 2 | grep MiB | less"
|
|
||||||
alias lg="lazygit"
|
if [[ $+commands[uwufetch] ]]; then
|
||||||
alias lad="lazydocker"
|
alias uf="uwufetch"
|
||||||
alias htop="btop"
|
fi
|
||||||
|
|
||||||
|
if [[ $+commands[pacman] ]]; then
|
||||||
|
# this lists packages installed with pacman by size in mebibytes
|
||||||
|
alias pacsize="pacman -Qi | egrep '^(Name|Installed)' | cut -f2 -d':' | paste - - | column -t | sort -nrk 2 | grep MiB | less"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $+commands[yay] ]]; then
|
||||||
|
alias aur="yay"
|
||||||
|
alias yaystats="yay -P --stats"
|
||||||
|
alias pacstats="yaystats"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $+commands[lazygit] ]]; then
|
||||||
|
alias lg="lazygit"
|
||||||
|
fi
|
||||||
|
if [[ $+commands[lazydocker] ]]; then
|
||||||
|
alias lad="lazydocker"
|
||||||
|
fi
|
||||||
|
if [[ $+commands[btop] ]]; then
|
||||||
|
alias htop="btop"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ "${XDG_SESSION_TYPE}" == "x11" ]]; then
|
if [[ "${XDG_SESSION_TYPE}" == "x11" ]]; then
|
||||||
|
if [[ $+commands[xsel] ]]; then
|
||||||
alias clip="xsel -ib"
|
alias clip="xsel -ib"
|
||||||
|
elif [[ $+commands[xclip] ]]; then
|
||||||
|
alias clip="xclip"
|
||||||
|
else
|
||||||
|
alias clip="Detected x11, but xsel or xclip are not installed."
|
||||||
|
fi
|
||||||
|
|
||||||
elif [[ -n "${WAYLAND_DISPLAY}" ]]; then
|
elif [[ -n "${WAYLAND_DISPLAY}" ]]; then
|
||||||
|
if [[ $+commands[wl-copy] ]]; then
|
||||||
alias clip="wl-copy"
|
alias clip="wl-copy"
|
||||||
|
else
|
||||||
|
alias clip="Detected Wayland, but wl-copy is not installed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif [[ -n "${SSH_CONNECTION}" ]]; then
|
||||||
|
if [[ $+commands[lemonade] ]]; then
|
||||||
|
alias clip="lemonade copy"
|
||||||
|
else
|
||||||
|
alias clip="Detected an SSH connection, but lemonade is not installed."
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
alias clip='echo "Cannot determine desktop session type, are you running a display server that is not X11 or Wayland?"'
|
alias clip='echo "Cannot determine desktop session type, are you running a display server that is not X11 or Wayland?"'
|
||||||
fi
|
fi
|
||||||
alias driver="nvidia-smi"
|
|
||||||
alias gpu="sudo nvidia-settings"
|
|
||||||
alias yaystats="yay -P --stats"
|
if [[ $+commands[nvidia-smi] ]]; then
|
||||||
alias pacstats="yaystats"
|
alias driver="nvidia-smi"
|
||||||
alias taildrop="tailscale file"
|
fi
|
||||||
|
if [[ $+commands[nvidia-settings] ]]; then
|
||||||
|
alias gpu="sudo nvidia-settings"
|
||||||
|
fi
|
||||||
|
if [[ $+commands[forgejo-runner] ]]; then
|
||||||
|
alias runactions="forgejo-runner exec --network=host --default-actions-url=https://www.coastalcommits.com --gitea-instance=https://www.coastalcommits.com"
|
||||||
|
fi
|
||||||
|
if [[ $+commands[tailscale] ]]; then
|
||||||
|
alias taildrop="tailscale file"
|
||||||
|
fi
|
||||||
alias protontricks="flatpak run com.github.Matoking.protontricks"
|
alias protontricks="flatpak run com.github.Matoking.protontricks"
|
||||||
alias sober="flatpak run org.vinegarhq.Sober"
|
alias sober="flatpak run org.vinegarhq.Sober"
|
||||||
alias runactions="forgejo-runner exec --network=host --default-actions-url=https://www.coastalcommits.com --gitea-instance=https://www.coastalcommits.com"
|
|
||||||
alias sudo="sudo "
|
alias sudo="sudo "
|
||||||
|
|
1
.zshrc
1
.zshrc
|
@ -106,4 +106,3 @@ fi
|
||||||
# Compilation flags
|
# Compilation flags
|
||||||
# export ARCHFLAGS="-arch x86_64"
|
# export ARCHFLAGS="-arch x86_64"
|
||||||
|
|
||||||
eval "$(navi widget zsh)"
|
|
||||||
|
|
Reference in a new issue