diff --git a/.profile b/.profile index 908b2d1..b6aa2c6 100644 --- a/.profile +++ b/.profile @@ -8,22 +8,39 @@ # for ssh logins, install and configure the libpam-umask package. #umask 022 -# set PATH so it includes user's private bin if it exists -if [ -d "$HOME/.local/bin" ] ; then - PATH="$HOME/.local/bin:$PATH" -fi +add_path () { + local EXTRA_PATH="${1}" + + if [[ -d "$EXTRA_PATH" ]]; then + case ":$PATH:" in + *:"$EXTRA_PATH":*) + ;; + *) + export PATH="$EXTRA_PATH:$PATH" + ;; + esac + fi +} -if [[ -x "$(command -v hx)" ]] ; then - export EDITOR="hx" -elif [[ -x "$(command -v vim)" ]] ; then - export EDITOR="vim" -fi +# set PATH so it includes user's private bin +add_path "$HOME/.local/bin" # set GOPATH and add bin directory to PATH variable export GOPATH="$HOME/.local/lib/go" -if [ -d "$GOPATH/bin" ] ; then - PATH="$GOPATH/bin:$PATH" +add_path "$GOPATH/bin" + +# add nvm bin to path +add_path "$HOME/.nvm/current/bin" + +# add cargo/rust bin to path +add_path "$HOME/.cargo/bin" + +# set default editor +if [[ -x "$(command -v hx)" ]] ; then + export EDITOR="hx" +elif [[ -x "$(command -v vim)" ]] ; then + export EDITOR="vim" fi # set default options for less