blob: 693c0241756964408bdce286f18982607f5a6eb4 [file] [log] [blame]
Eitan Adler3fc60b52012-04-17 00:24:58 -04001#!/usr/bin/env bash
Robert R Evans9c7cd9a2010-10-02 11:55:34 -07002# Initialize Bash It
3
4# Reload Library
5alias reload='source ~/.bash_profile'
6
John Schulze3194232011-10-28 19:22:20 -04007# Only set $BASH_IT if it's not already set
Travis Swicegoodb59ee652011-10-29 18:56:36 -05008if [ -z "$BASH_IT" ];
9then
10 # Setting $BASH to maintain backwards compatibility
11 # TODO: warn users that they should upgrade their .bash_profile
12 export BASH_IT=$BASH
13 export BASH=`bash -c 'echo $BASH'`
14fi
15
16# For backwards compatibility, look in old BASH_THEME location
17if [ -z "$BASH_IT_THEME" ];
18then
19 # TODO: warn users that they should upgrade their .bash_profile
20 export BASH_IT_THEME="$BASH_THEME";
21 unset $BASH_THEME;
22fi
Robert R Evans9c7cd9a2010-10-02 11:55:34 -070023
Erich Smitha8fcf9f2012-04-27 15:07:04 -040024# Load composure first, so we support function metadata
25source "${BASH_IT}/lib/composure.sh"
26
Travis Swicegoodb6d444d2011-10-29 18:55:20 -050027# Load colors first so they can be use in base theme
28source "${BASH_IT}/themes/colors.theme.bash"
29source "${BASH_IT}/themes/base.theme.bash"
30
31# library
32LIB="${BASH_IT}/lib/*.bash"
33for config_file in $LIB
34do
35 source $config_file
36done
37
Travis Swicegoodd7cfa8b2011-06-21 09:31:26 -050038# Load enabled aliases, completion, plugins
39for file_type in "aliases" "completion" "plugins"
Robert R Evans9c7cd9a2010-10-02 11:55:34 -070040do
Travis Swicegoodb524bb62012-03-26 11:19:38 -050041 _load_bash_it_files $file_type
Robert R Evans9c7cd9a2010-10-02 11:55:34 -070042done
43
Travis Swicegoodd7cfa8b2011-06-21 09:31:26 -050044# Load any custom aliases that the user has added
John Schulz323ce202011-09-20 11:07:48 -040045if [ -e "${BASH_IT}/aliases/custom.aliases.bash" ]
Mark Szymanski78270b32011-06-17 11:22:39 -050046then
John Schulz323ce202011-09-20 11:07:48 -040047 source "${BASH_IT}/aliases/custom.aliases.bash"
Mark Szymanski78270b32011-06-17 11:22:39 -050048fi
Mark Szymanski50179fd2011-06-13 22:05:45 -050049
Robert R Evans9c7cd9a2010-10-02 11:55:34 -070050# Custom
John Schulz323ce202011-09-20 11:07:48 -040051CUSTOM="${BASH_IT}/custom/*.bash"
Robert R Evans9c7cd9a2010-10-02 11:55:34 -070052for config_file in $CUSTOM
53do
Jon Schewe7d18ccc2011-10-09 20:44:29 -050054 if [ -e "${config_file}" ]; then
55 source $config_file
56 fi
Robert R Evansa7d1ee02010-10-02 15:04:24 -070057done
58
Robert R Evans2010f012010-10-10 09:24:19 -070059unset config_file
John Schulz6e7f4232010-11-11 11:57:47 -050060if [[ $PROMPT ]]; then
61 export PS1=$PROMPT
62fi
Robert R Evansc9da0862010-10-06 17:27:55 -070063
64# Adding Support for other OSes
65PREVIEW="less"
66[ -s /usr/bin/gloobus-preview ] && PREVIEW="gloobus-preview"
67[ -s /Applications/Preview.app ] && PREVIEW="/Applications/Preview.app"
68
Mark Szymanski9ad79642011-06-24 17:49:19 -050069# Load all the Jekyll stuff
70
71if [ -e $HOME/.jekyllconfig ]
72then
73 . $HOME/.jekyllconfig
74fi
75
Robert R Evansc9da0862010-10-06 17:27:55 -070076
Robert R Evansa7d1ee02010-10-02 15:04:24 -070077#
78# Custom Help
79
80function bash-it() {
81 echo "Welcome to Bash It!"
82 echo
83 echo "Here is a list of commands you can use to get help screens for specific pieces of Bash it:"
84 echo
Erich Smith19206292012-05-13 21:44:12 -040085 echo " rails-help list out all aliases you can use with rails."
86 echo " git-help list out all aliases you can use with git."
87 echo " todo-help list out all aliases you can use with todo.txt-cli"
88 echo " brew-help list out all aliases you can use with Homebrew"
89 echo " aliases-help generic list of aliases."
90 echo " plugins-help list out all functions you have installed with bash-it"
91 echo " bash-it-plugins summarize bash-it plugins, and their installation status"
92 echo " reference <function name> detailed help for a specific function"
Robert R Evansa7d1ee02010-10-02 15:04:24 -070093 echo
Mark Szymanskie6fb7032010-10-31 15:32:22 -050094}