bash: check for brew after PATH manipulation
This commit is contained in:
parent
b16ca6a626
commit
c141e51b66
1 changed files with 9 additions and 11 deletions
20
files/bashrc
20
files/bashrc
|
@ -23,11 +23,6 @@ export LESSHISTFILE="$XDG_DATA_HOME/less/history"
|
|||
export LESSHISTSIZE=1000
|
||||
export LOCAL_CONFIG="$HOME/.local/etc"
|
||||
export LOCAL_PREFIX="/usr/local"
|
||||
if command -v brew &>/dev/null; then
|
||||
LOCAL_PREFIX="$(brew --prefix)"
|
||||
export HOMEBREW_NO_ANALYTICS=1
|
||||
export HOMEBREW_NO_AUTO_UPDATE=1
|
||||
fi
|
||||
MANPATH="$(unset MANPATH; manpath)"
|
||||
export MANPATH
|
||||
export PAGER=less
|
||||
|
@ -35,17 +30,13 @@ export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/startup.py"
|
|||
# shellcheck disable=SC2016 # This expression is to be interpreted by vim, not bash.
|
||||
export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC'
|
||||
|
||||
##############################################################################
|
||||
# Customize PATH (and MANPATH)
|
||||
##############################################################################
|
||||
|
||||
# Prevent path_helper from messing with the PATH when starting tmux.
|
||||
# See: https://superuser.com/a/583502
|
||||
# shellcheck disable=SC2123 # PATH is being intentionally manipulated here.
|
||||
# shellcheck disable=SC1091 # /etc/profile is provided by macOS.
|
||||
[ "$(uname)" == "Darwin" ] && { PATH=""; source /etc/profile; }
|
||||
|
||||
_prepend_path() { # 1: dir to add, 2: path variable to manipulate
|
||||
_prepend_path() { # prepend $1 to variable $2 using : as separator
|
||||
if [ -d "$1" ] && [ -n "$2" ]; then
|
||||
local _path="${!2}" # get path variable value
|
||||
case ":$_path:" in
|
||||
|
@ -76,7 +67,14 @@ while read -r dir; do _prepend_path "$dir" MANPATH; done <<EOL
|
|||
$HOME/.local/share/man
|
||||
EOL
|
||||
|
||||
unset dir
|
||||
unset dir _prepend_path
|
||||
|
||||
# This check has to be done after PATH manipulation above so we can find brew.
|
||||
if command -v brew >/dev/null 2>&1; then
|
||||
LOCAL_PREFIX="$(brew --prefix)"
|
||||
export HOMEBREW_NO_ANALYTICS=1
|
||||
export HOMEBREW_NO_AUTO_UPDATE=1
|
||||
fi
|
||||
|
||||
stty -ixon # disable ctrl-s and ctrl-q
|
||||
command -v solarize >/dev/null && solarize
|
||||
|
|
Loading…
Add table
Reference in a new issue