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.
|
||||
#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 [[ -x "$(command -v hx)" ]] ; then
|
||||
export EDITOR="hx"
|
||||
elif [[ -x "$(command -v vim)" ]] ; then
|
||||
export EDITOR="vim"
|
||||
fi
|
||||
if [[ -d "$EXTRA_PATH" ]]; then
|
||||
case ":$PATH:" in
|
||||
*:"$EXTRA_PATH":*)
|
||||
;;
|
||||
*)
|
||||
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
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user