.dotfiles/zsh/env
2024-08-11 00:36:17 +02:00

110 lines
2.5 KiB
Plaintext

#--------------------------------
# filename: /zsh/env
#--------------------------------
# set language
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_TYPE=en_US.UTF-8
# set default editor
export EDITOR="nano"
# set `ll` alias
# eza > lsd > bls
alias ll=bls
if [[ -x $(which lsd) ]]; then
alias ll=lsd
alias lsd='pwd; lsd -laF --group-dirs=first --icon=never'
fi
if [[ -x $(which eza) ]]; then
alias ll=eza
alias eza='pwd; eza --long --all --all --group-directories-first --git --group'
fi
## Better LS
if [[ $platform == 'Linux' ]]; then
alias bls='pwd; ls -lahp --color=auto --group-directories-first'
elif [[ $platform == 'macOS' && -x $(which gls) ]]; then
alias bls='pwd; gls -lahpG --group-directories-first'
elif [[ $platform == 'macOS' ]]; then
alias bls='pwd; /bin/ls -lahGp'
fi
#
# Path additions
#
if test -d "$HOME/.dotfiles/scripts"; then
export PATH="$HOME/.dotfiles/scripts:$PATH"
fi
if test -d "/opt/homebrew/"; then
export PATH="/opt/homebrew/bin:$PATH"
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
if test -d "/home/linuxbrew/.linuxbrew/"; then
export PATH="/home/linuxbrew/.linuxbrew/bin/:$PATH"
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
if test -d "$HOME/go"; then
export PATH="$HOME/go/bin:$PATH"
fi
if test -d "$HOME/.rbenv"; then
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
fi
if test -d "$HOME/.cargo"; then
export PATH="$HOME/.cargo/bin:$PATH"
eval "$(rbenv init -)"
fi
if test -d "$HOME/.local"; then
export PATH="$HOME/.local/bin:$PATH"
fi
# Add syncthing synced binary folder to $PATH
if [[ $platform == 'macOS' ]]; then
export PATH="$HOME/SyncMac/Apps/bin/universal:$PATH"
export PATH="$HOME/SyncMac/Apps/bin/x86_64_rosetta2:$PATH"
if [[ $arch == 'arm' ]]; then
export PATH="$HOME/SyncMac/Apps/bin/arm64:$PATH"
elif [[ $arch == 'i386' ]]; then
export PATH="$HOME/SyncMac/Apps/bin/x86_64:$PATH"
fi
fi
if test -d "$homebrew_opt/openjdk/bin/"; then
export PATH="$homebrew_opt/openjdk/bin:$PATH"
fi
if test -d "$homebrew_opt/php@7.4"; then
export PATH="$homebrew_opt/php@7.4/bin:$PATH"
fi
if test -d "$homebrew_opt/ruby"; then
export PATH="$homebrew_opt/ruby/bin:$PATH"
fi
if test -d "/usr/local/sbin"; then
export PATH="/usr/local/sbin:$PATH"
fi
#
# evals
#
# Replace default `thefuck` eval with suggestion from GitHub
# https://github.com/nvbn/thefuck/issues/859
if command -v thefuck >/dev/null 2>&1; then
fuck() {
eval "$(thefuck --alias)" && fuck
}
fi