diff --git a/README.md b/README.md index 0ec3cd1..c4bc2db 100644 --- a/README.md +++ b/README.md @@ -266,6 +266,13 @@ GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_ " # displays as ✘-1 fo git_prompt_reset ``` +- You can disable/enable gitprompt by runnning: + +```sh +git_prompt_toggle +``` + + **Enjoy!** ## Alternative RPM Install diff --git a/gitprompt.sh b/gitprompt.sh index 992436f..899bea4 100755 --- a/gitprompt.sh +++ b/gitprompt.sh @@ -331,7 +331,7 @@ function setGitPrompt() { git_prompt_config - if [[ ! -e "$repo" ]]; then + if [[ ! -e "$repo" ]] || [[ "$GIT_PROMPT_DISABLE" = 1 ]]; then PS1="$EMPTY_PROMPT" return fi @@ -570,6 +570,16 @@ function prompt_callback_default { return } +# toggle gitprompt +function git_prompt_toggle() { + if [[ "$GIT_PROMPT_DISABLE" = 1 ]]; then + GIT_PROMPT_DISABLE=0 + else + GIT_PROMPT_DISABLE=1 + fi + return +} + function gp_install_prompt { if [ -z "$OLD_GITPROMPT" ]; then OLD_GITPROMPT=$PS1