refactor adding paths
This commit is contained in:
39
.profile
39
.profile
@@ -8,22 +8,39 @@
|
|||||||
# for ssh logins, install and configure the libpam-umask package.
|
# for ssh logins, install and configure the libpam-umask package.
|
||||||
#umask 022
|
#umask 022
|
||||||
|
|
||||||
# set PATH so it includes user's private bin if it exists
|
add_path () {
|
||||||
if [ -d "$HOME/.local/bin" ] ; then
|
local EXTRA_PATH="${1}"
|
||||||
PATH="$HOME/.local/bin:$PATH"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -x "$(command -v hx)" ]] ; then
|
if [[ -d "$EXTRA_PATH" ]]; then
|
||||||
export EDITOR="hx"
|
case ":$PATH:" in
|
||||||
elif [[ -x "$(command -v vim)" ]] ; then
|
*:"$EXTRA_PATH":*)
|
||||||
export EDITOR="vim"
|
;;
|
||||||
fi
|
*)
|
||||||
|
export PATH="$EXTRA_PATH:$PATH"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# set PATH so it includes user's private bin
|
||||||
|
add_path "$HOME/.local/bin"
|
||||||
|
|
||||||
# set GOPATH and add bin directory to PATH variable
|
# set GOPATH and add bin directory to PATH variable
|
||||||
export GOPATH="$HOME/.local/lib/go"
|
export GOPATH="$HOME/.local/lib/go"
|
||||||
|
|
||||||
if [ -d "$GOPATH/bin" ] ; then
|
add_path "$GOPATH/bin"
|
||||||
PATH="$GOPATH/bin:$PATH"
|
|
||||||
|
# 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
|
fi
|
||||||
|
|
||||||
# set default options for less
|
# set default options for less
|
||||||
|
|||||||
Reference in New Issue
Block a user