dotfiles/dot_bashrc.d/executable_03.ENV.tmpl
rocky 0e0c2241a2 (ENV): Change to template and add vim variables.
Use variable 'vimexec' as EDITOR and VISUAL env variables.
2024-11-13 08:58:52 +00:00

29 lines
654 B
Bash
Executable File

#!/usr/bin/env bash
# BINs and PATH
# extend path if directory exists and is not yet contained
# https://askubuntu.com/questions/432217/prevent-duplicate-entries-in-path
function extendPath() {
local new_dir=$1
if [ -d "$new_dir" ]; then
[[ ":$PATH:" =~ :$new_dir: ]] || PATH="$new_dir:$PATH"
fi
}
if [ -x /usr/bin/go ]; then
extendPath "$(go env GOPATH)/bin"
export GOPATH=$(go env GOPATH)
fi
if [ -d "$HOME/.cargo/bin" ]; then
extendPath "$HOME/.cargo/bin"
fi
extendPath "$HOME/bin"
extendPath "/usr/local/bin"
extendPath "$HOME/.local/bin"
export PATH
export EDITOR="{{ .vimexec }}"
export VISUAL="{{ .vimexec }}"