Robert R Evans | 76ed68d | 2010-10-02 12:29:17 -0700 | [diff] [blame] | 1 | #!/bin/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 | |
Robert R Evans | 79e5029 | 2010-10-12 14:14:20 -0700 | [diff] [blame] | 7 | # Load the framework |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 8 | |
John Schulz | d5645e7 | 2010-11-09 23:21:19 -0500 | [diff] [blame] | 9 | # Load colors first so they can be use in base theme |
| 10 | source "${BASH}/themes/colors.theme.bash" |
| 11 | source "${BASH}/themes/base.theme.bash" |
Robert R Evans | 070107a | 2010-10-02 15:23:57 -0700 | [diff] [blame] | 12 | |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 13 | # Library |
| 14 | LIB="${BASH}/lib/*.bash" |
| 15 | for config_file in $LIB |
| 16 | do |
| 17 | source $config_file |
| 18 | done |
| 19 | |
Travis Swicegood | e115b4c | 2011-06-21 09:20:40 -0500 | [diff] [blame] | 20 | # TODO: reduce the repetition here by combining these three into a loop |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 21 | # Tab Completion |
Travis Swicegood | e115b4c | 2011-06-21 09:20:40 -0500 | [diff] [blame] | 22 | if [ ! -d "${BASH}/completion/enabled" ] |
| 23 | then |
| 24 | mkdir "${BASH}/completion/enabled" |
| 25 | ln -s ${BASH}/completion/available/* "${BASH}/completion/enabled" |
| 26 | fi |
| 27 | COMPLETION="${BASH}/completion/enabled/*.bash" |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 28 | for config_file in $COMPLETION |
| 29 | do |
| 30 | source $config_file |
| 31 | done |
| 32 | |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 33 | # Plugins |
Mark Szymanski | 4814843 | 2011-05-27 20:57:57 -0500 | [diff] [blame] | 34 | if [ ! -d "${BASH}/plugins/enabled" ] |
Mark Szymanski | 1b268e7 | 2011-05-27 11:53:54 -0500 | [diff] [blame] | 35 | then |
| 36 | mkdir "${BASH}/plugins/enabled" |
| 37 | ln -s ${BASH}/plugins/available/* "${BASH}/plugins/enabled" |
| 38 | fi |
Travis Swicegood | ffa45b0 | 2011-05-02 23:05:59 -0500 | [diff] [blame] | 39 | PLUGINS="${BASH}/plugins/enabled/*.bash" |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 40 | for config_file in $PLUGINS |
| 41 | do |
| 42 | source $config_file |
| 43 | done |
| 44 | |
Robert R Evans | 2010f01 | 2010-10-10 09:24:19 -0700 | [diff] [blame] | 45 | # Aliases |
Travis Swicegood | ef42010 | 2011-06-12 19:44:27 -0500 | [diff] [blame] | 46 | if [ ! -d "${BASH}/aliases/enabled" ] |
| 47 | then |
| 48 | mkdir "${BASH}/aliases/enabled" |
| 49 | ln -s ${BASH}/aliases/available/* "${BASH}/aliases/enabled" |
| 50 | fi |
| 51 | FUNCTIONS="${BASH}/aliases/enabled/*.bash" |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 52 | for config_file in $FUNCTIONS |
| 53 | do |
| 54 | source $config_file |
| 55 | done |
| 56 | |
Mark Szymanski | 78270b3 | 2011-06-17 11:22:39 -0500 | [diff] [blame] | 57 | if [ -e "${BASH}/aliases/custom.aliases.bash" ] |
| 58 | then |
| 59 | source "${BASH}/aliases/custom.aliases.bash" |
| 60 | fi |
Mark Szymanski | 50179fd | 2011-06-13 22:05:45 -0500 | [diff] [blame] | 61 | |
Robert R Evans | 9c7cd9a | 2010-10-02 11:55:34 -0700 | [diff] [blame] | 62 | # Custom |
| 63 | CUSTOM="${BASH}/custom/*.bash" |
| 64 | for config_file in $CUSTOM |
| 65 | do |
| 66 | source $config_file |
Robert R Evans | a7d1ee0 | 2010-10-02 15:04:24 -0700 | [diff] [blame] | 67 | done |
| 68 | |
Robert R Evans | 2010f01 | 2010-10-10 09:24:19 -0700 | [diff] [blame] | 69 | |
| 70 | unset config_file |
John Schulz | 6e7f423 | 2010-11-11 11:57:47 -0500 | [diff] [blame] | 71 | if [[ $PROMPT ]]; then |
| 72 | export PS1=$PROMPT |
| 73 | fi |
Robert R Evans | c9da086 | 2010-10-06 17:27:55 -0700 | [diff] [blame] | 74 | |
| 75 | # Adding Support for other OSes |
| 76 | PREVIEW="less" |
| 77 | [ -s /usr/bin/gloobus-preview ] && PREVIEW="gloobus-preview" |
| 78 | [ -s /Applications/Preview.app ] && PREVIEW="/Applications/Preview.app" |
| 79 | |
| 80 | |
Robert R Evans | a7d1ee0 | 2010-10-02 15:04:24 -0700 | [diff] [blame] | 81 | # |
| 82 | # Custom Help |
| 83 | |
| 84 | function bash-it() { |
| 85 | echo "Welcome to Bash It!" |
| 86 | echo |
| 87 | echo "Here is a list of commands you can use to get help screens for specific pieces of Bash it:" |
| 88 | echo |
| 89 | echo " rails-help This will list out all the aliases you can use with rails." |
| 90 | 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] | 91 | 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] | 92 | 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] | 93 | echo " aliases-help Generic list of aliases." |
Florian Baumann | bd22485 | 2010-11-08 21:52:49 +0100 | [diff] [blame] | 94 | 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] | 95 | echo |
Mark Szymanski | e6fb703 | 2010-10-31 15:32:22 -0500 | [diff] [blame] | 96 | } |