Eitan Adler | 3fc60b5 | 2012-04-17 00:24:58 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 2 | # Initialize Bash It |
| 3 | |
| 4 | # Reload Library |
| 5 | alias reload='source ~/.bash_profile' |
| 6 | |
John Schulz | e319423 | 2011-10-28 19:22:20 -0400 | [diff] [blame] | 7 | # Only set $BASH_IT if it's not already set |
Travis Swicegood | b59ee65 | 2011-10-29 18:56:36 -0500 | [diff] [blame] | 8 | if [ -z "$BASH_IT" ]; |
| 9 | then |
| 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'` |
| 14 | fi |
| 15 | |
| 16 | # For backwards compatibility, look in old BASH_THEME location |
| 17 | if [ -z "$BASH_IT_THEME" ]; |
| 18 | then |
| 19 | # TODO: warn users that they should upgrade their .bash_profile |
| 20 | export BASH_IT_THEME="$BASH_THEME"; |
| 21 | unset $BASH_THEME; |
| 22 | fi |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 23 | |
Travis Swicegood | b6d444d | 2011-10-29 18:55:20 -0500 | [diff] [blame] | 24 | # Load colors first so they can be use in base theme |
| 25 | source "${BASH_IT}/themes/colors.theme.bash" |
| 26 | source "${BASH_IT}/themes/base.theme.bash" |
| 27 | |
| 28 | # library |
| 29 | LIB="${BASH_IT}/lib/*.bash" |
| 30 | for config_file in $LIB |
| 31 | do |
| 32 | source $config_file |
| 33 | done |
| 34 | |
Travis Swicegood | d7cfa8b | 2011-06-21 09:31:26 -0500 | [diff] [blame] | 35 | # Load enabled aliases, completion, plugins |
| 36 | for file_type in "aliases" "completion" "plugins" |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 37 | do |
Travis Swicegood | b524bb6 | 2012-03-26 11:19:38 -0500 | [diff] [blame] | 38 | _load_bash_it_files $file_type |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 39 | done |
| 40 | |
Travis Swicegood | d7cfa8b | 2011-06-21 09:31:26 -0500 | [diff] [blame] | 41 | # Load any custom aliases that the user has added |
John Schulz | 323ce20 | 2011-09-20 11:07:48 -0400 | [diff] [blame] | 42 | if [ -e "${BASH_IT}/aliases/custom.aliases.bash" ] |
Mark Szymanski | 78270b3 | 2011-06-17 11:22:39 -0500 | [diff] [blame] | 43 | then |
John Schulz | 323ce20 | 2011-09-20 11:07:48 -0400 | [diff] [blame] | 44 | source "${BASH_IT}/aliases/custom.aliases.bash" |
Mark Szymanski | 78270b3 | 2011-06-17 11:22:39 -0500 | [diff] [blame] | 45 | fi |
Mark Szymanski | 50179fd | 2011-06-13 22:05:45 -0500 | [diff] [blame] | 46 | |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 47 | # Custom |
John Schulz | 323ce20 | 2011-09-20 11:07:48 -0400 | [diff] [blame] | 48 | CUSTOM="${BASH_IT}/custom/*.bash" |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 49 | for config_file in $CUSTOM |
| 50 | do |
Jon Schewe | 7d18ccc | 2011-10-09 20:44:29 -0500 | [diff] [blame] | 51 | if [ -e "${config_file}" ]; then |
| 52 | source $config_file |
| 53 | fi |
Robert R Evans | a7d1ee0 | 2010-10-02 15:04:24 -0700 | [diff] [blame] | 54 | done |
| 55 | |
Robert R Evans | 2010f01 | 2010-10-10 09:24:19 -0700 | [diff] [blame] | 56 | unset config_file |
John Schulz | 6e7f423 | 2010-11-11 11:57:47 -0500 | [diff] [blame] | 57 | if [[ $PROMPT ]]; then |
| 58 | export PS1=$PROMPT |
| 59 | fi |
Robert R Evans | c9da086 | 2010-10-06 17:27:55 -0700 | [diff] [blame] | 60 | |
| 61 | # Adding Support for other OSes |
| 62 | PREVIEW="less" |
| 63 | [ -s /usr/bin/gloobus-preview ] && PREVIEW="gloobus-preview" |
| 64 | [ -s /Applications/Preview.app ] && PREVIEW="/Applications/Preview.app" |
| 65 | |
Mark Szymanski | 9ad7964 | 2011-06-24 17:49:19 -0500 | [diff] [blame] | 66 | # Load all the Jekyll stuff |
| 67 | |
| 68 | if [ -e $HOME/.jekyllconfig ] |
| 69 | then |
| 70 | . $HOME/.jekyllconfig |
| 71 | fi |
| 72 | |
Robert R Evans | c9da086 | 2010-10-06 17:27:55 -0700 | [diff] [blame] | 73 | |
Robert R Evans | a7d1ee0 | 2010-10-02 15:04:24 -0700 | [diff] [blame] | 74 | # |
| 75 | # Custom Help |
| 76 | |
| 77 | function bash-it() { |
| 78 | echo "Welcome to Bash It!" |
| 79 | echo |
| 80 | echo "Here is a list of commands you can use to get help screens for specific pieces of Bash it:" |
| 81 | echo |
| 82 | echo " rails-help This will list out all the aliases you can use with rails." |
| 83 | echo " git-help This will list out all the aliases you can use with git." |
Mark Szymanski | e6fb703 | 2010-10-31 15:32:22 -0500 | [diff] [blame] | 84 | echo " todo-help This will list out all the aliases you can use with todo.txt-cli" |
Mark Szymanski | b7a0cb6 | 2011-06-05 20:45:53 -0500 | [diff] [blame] | 85 | echo " brew-help This will list out all the aliases you can use with Homebrew" |
Robert R Evans | 5e0e86f | 2010-10-02 15:29:23 -0700 | [diff] [blame] | 86 | echo " aliases-help Generic list of aliases." |
Florian Baumann | bd22485 | 2010-11-08 21:52:49 +0100 | [diff] [blame] | 87 | echo " plugins-help This will list out all the plugins and functions you can use with bash-it" |
Robert R Evans | a7d1ee0 | 2010-10-02 15:04:24 -0700 | [diff] [blame] | 88 | echo |
Mark Szymanski | e6fb703 | 2010-10-31 15:32:22 -0500 | [diff] [blame] | 89 | } |