zsh/.zshenv
2025-03-18 10:05:09 +01:00

74 lines
3 KiB
Bash
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ───────────────────────────────────< Message storage >─────────────────────────────────
typeset -A _MESSAGES
_MESSAGES=(
[error]=""
[warn]=""
[info]=""
)
# Define color variables
RED='\033[0;31m'
YELLOW='\033[0;33m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
BOLD='\033[1m'
# Functions to store messages
echo_error() {
_MESSAGES[error]+="${RED}$1${NC}\n"
}
echo_warning() {
_MESSAGES[warn]+="${YELLOW}⚠️ $1${NC}\n"
}
echo_info() {
_MESSAGES[info]+="${CYAN} $1${NC}\n"
}
# ─< Check if the given command exists silently >─────────────────────────────────────────
command_exists() {
command -v "$@" >/dev/null 2>&1
}
# ─< paths >──────────────────────────────────────────────────────────────────────────────
if [ -d "$HOME/.local/bin" ]; then
export PATH="$HOME/.local/bin:$PATH"
if [ -e "$HOME/.local/bin/lazydocker" ]; then
alias ld="$HOME/.local/bin/lazydocker"
fi
fi
if command_exists nvim; then
export EDITOR="nvim"
else
# ─< linux binary via script installation >───────────────────────────────────────────────
[ -d "$HOME/.bin/nvim-linux64/bin" ] && {
export PATH="$HOME/.bin/nvim-linux64/bin:$PATH"
export EDITOR="$HOME/.bin/nvim-linux64/bin/nvim"
echo_info "neovim at $HOME/.bin/nvim-linux64/bin/nvim"
}
fi
# ─< go bin path >────────────────────────────────────────────────────────────────────────
[ -d "$HOME/go/bin" ] && {
export PATH="$HOME/go/bin:$PATH"
echo_info "Go programs at $HOME/go/bin/"
}
# ─< cargo bin path >─────────────────────────────────────────────────────────────────────
if [ -e "$HOME/.cargo/env" ]; then
echo_info "Loadet $HOME/.cargo/env"
. "$HOME/.cargo/env"
else
[ -d "$HOME/.cargo/bin" ] && {
export PATH="$HOME/.cargo/bin:$PATH"
echo_info "Cargo programs at $HOME/.cargo/bin/"
}
fi
# bun completions
# [ -s "$HOME/.bun/_bun" ] && . "$HOME/.bun/_bun"
# [ -s "$HOME/.bun/_bun" ] && export BUN_INSTALL="$HOME/.bun" && export PATH="$BUN_INSTALL/bin:$PATH"
# ─< fzf plugin >─────────────────────────────────────────────────────────────────────────
[ -d "$HOME/.zsh/plugins/fzf-zsh-plugin/bin" ] && export PATH="$HOME/.zsh/plugins/fzf-zsh-plugin/bin:$PATH"