Add git_prompt_toggle to disable/enable gitprompt

master
nexayq 10 years ago
parent 9497f55601
commit 1d32369dab
  1. 7
      README.md
  2. 12
      gitprompt.sh

@ -266,6 +266,13 @@ GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_ " # displays as ✘-1 fo
git_prompt_reset git_prompt_reset
``` ```
- You can disable/enable gitprompt by runnning:
```sh
$ git_prompt_toggle`
```
**Enjoy!** **Enjoy!**
## Alternative RPM Install ## Alternative RPM Install

@ -331,7 +331,7 @@ function setGitPrompt() {
git_prompt_config git_prompt_config
if [[ ! -e "$repo" ]]; then if [[ ! -e "$repo" ]] || [[ "$GIT_PROMPT_DISABLE" = 1 ]]; then
PS1="$EMPTY_PROMPT" PS1="$EMPTY_PROMPT"
return return
fi fi
@ -570,6 +570,16 @@ function prompt_callback_default {
return 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 { function gp_install_prompt {
if [ -z "$OLD_GITPROMPT" ]; then if [ -z "$OLD_GITPROMPT" ]; then
OLD_GITPROMPT=$PS1 OLD_GITPROMPT=$PS1

Loading…
Cancel
Save