# This file sets up the environment

pathmunge() {
  [ -d "$1" ] && case ":$PATH:" in
    *:$1:*) ;;
    *) [ "$2" = "after" ] && PATH="$PATH:$1" || PATH="$1:$PATH"
  esac
  export PATH
}

pathmunge "$HOME/.cargo/bin"
pathmunge "$HOME/.cabal/bin"
pathmunge "$HOME/node_modules/.bin"
pathmunge "$HOME/.foundry/bin"
pathmunge "$HOME/bin"
pathmunge "$HOME/.local/bin"

pathmunge "/home/linuxbrew/.linuxbrew/bin"
if [ -e "/home/linuxbrew/.linuxbrew/bin/brew" ]; then
  eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
else if [ -e "/opt/homebrew/bin/brew" ]
  eval "$(/opt/homebrew/bin/brew shellenv)"
fi

if [ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
  . "$HOME/.nix-profile/etc/profile.d/nix.sh"
fi

export PYTHONSTARTUP="$HOME/.pythonrc.py"
export PAGER="$HOME/bin/vimpager"

export EDITOR=vim
if command -v nvim > /dev/null 2>&1; then
  export EDITOR=nvim
fi

# BSD ls color
export LSCOLORS="Exfxcxdxbxegedabagacad"
ls --color=auto > /dev/null 2>&1 || \
  ls -G -d / > /dev/null 2>&1 && export CLICOLOR=yes

# vim: se ft=sh:
