diff --git a/README.md b/README.md index 36779e83..f28a996a 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,8 @@ Please take a look at the [Contribution Guidelines](CONTRIBUTING.md) before repo Bash-it creates a `reload` alias that makes it convenient to reload your Bash profile when you make changes. +Additionally, if you export BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE as a non-null value, Bash-it will automatically reload itself after activating or deactivating plugins, aliases, or completions. + ### Prompt Version Control Check Bash-it provides prompt themes the ability to check and display version control information for the current directory. The information is retrieved for each directory and can slow down the navigation of projects with a large number of files and folders. Turn version control checking off to prevent slow directory navigation within large projects. diff --git a/lib/helpers.bash b/lib/helpers.bash index 0920b9b7..eb546db9 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -243,7 +243,9 @@ _disable-thing () rm $BASH_IT/$subdirectory/enabled/$(basename $plugin) fi - exec ${0/-/} + if [ -n "$BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE" ]; then + exec ${0/-/} + fi printf '%s\n' "$file_entity disabled." } @@ -323,7 +325,9 @@ _enable-thing () ln -s ../available/$plugin $BASH_IT/$subdirectory/enabled/$plugin fi - exec ${0/-/} + if [ -n "$BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE" ]; then + exec ${0/-/} + fi printf '%s\n' "$file_entity enabled." } diff --git a/template/bash_profile.template.bash b/template/bash_profile.template.bash index 32266133..ea9a9860 100755 --- a/template/bash_profile.template.bash +++ b/template/bash_profile.template.bash @@ -30,5 +30,9 @@ export SCM_CHECK=true # https://github.com/djl/vcprompt #export VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt +# (Advanced): Uncomment this to make Bash-it reload itself automatically +# after enabling or disabling aliases, plugins, and completions. +# export BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE=1 + # Load Bash It source $BASH_IT/bash_it.sh