Skip to content

Commit

Permalink
bash: use alrra's cleanup of bash_profile
Browse files Browse the repository at this point in the history
  • Loading branch information
necolas committed Nov 2, 2013
1 parent 7647ce8 commit 5bdf493
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 31 deletions.
56 changes: 32 additions & 24 deletions bash/bash_profile
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,39 @@

# bash_profile

declare -a files=(
$HOME/.rvm/scripts/rvm # Load RVM into a shell session *as a function*
$HOME/.dotfiles/bash/bash_options # Options
$HOME/.dotfiles/bash/bash_exports # Exports
$HOME/.dotfiles/bash/bash_aliases # Aliases
$HOME/.dotfiles/bash/functions/* # Functions
$HOME/.dotfiles/bash/bash_prompt # Custom bash prompt
$HOME/.bash_profile.local # Local and private settings not under version control (e.g. git credentials)
$HOME/.dotfiles/bash/bash_paths # Path modifications (must source after `.bash_profile.local` in case of custom `brew` location)
)
load_dotfiles() {
declare -a files=(
$HOME/.rvm/scripts/rvm # Load RVM into a shell session *as a function*
$HOME/.dotfiles/bash/bash_options # Options
$HOME/.dotfiles/bash/bash_exports # Exports
$HOME/.dotfiles/bash/bash_aliases # Aliases
$HOME/.dotfiles/bash/functions/* # Functions
$HOME/.dotfiles/bash/bash_prompt # Custom bash prompt
$HOME/.bash_profile.local # Local and private settings not under version control (e.g. git credentials)
$HOME/.dotfiles/bash/bash_paths # Path modifications (must source after `.bash_profile.local` in case of custom `brew` location)
)

# If these files are readable, source them
for index in ${!files[*]}
do
if [[ -r ${files[$index]} ]]; then
source ${files[$index]}
fi
done
# if these files are readable, source them
for index in ${!files[*]}
do
if [[ -r ${files[$index]} ]]; then
source ${files[$index]}
fi
done
}

unset files

# Only use `brew` after it has been added to the PATH
bash_completion_path="$(brew --prefix)/etc/bash_completion"
# source Bash completion (installed via Homebrew)
# only use `brew` after it has been added to the PATH
if [[ -r $(brew --prefix)/etc/bash_completion ]]; then
source $(brew --prefix)/etc/bash_completion
fi

# Source Bash completion (installed via Homebrew)
if [[ -r $bash_completion_path ]]; then
source $bash_completion_path
# set 256 color profile where possible
if [[ $COLORTERM == gnome-* && $TERM == xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM=gnome-256color
elif infocmp xterm-256color >/dev/null 2>&1; then
export TERM=xterm-256color
fi

load_dotfiles
unset load_dotfiles
7 changes: 0 additions & 7 deletions bash/bash_prompt
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
# Color ref: http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim
# More tips: http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html


# Check that terminfo exists before changing TERM var to xterm-256color
# Prevents prompt flashing in Mac OS X 10.6 Terminal.app
if [ -e /usr/share/terminfo/x/xterm-256color ]; then
export TERM='xterm-256color'
fi

prompt_git() {
local s=""
local branchName=""
Expand Down

0 comments on commit 5bdf493

Please sign in to comment.