From 34e9525f1a14543e04408ec2698a7dc8d5b0889e Mon Sep 17 00:00:00 2001 From: "Carlos E. Reynosa-Nunez" Date: Sat, 4 Oct 2014 17:13:23 -0700 Subject: [PATCH 1/4] Added a flag within the base theme to turn version control checks completely off or on. --- themes/base.theme.bash | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 54ab2f54..fc32527c 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -1,6 +1,9 @@ #!/usr/bin/env bash THEME_PROMPT_HOST='\H' + +SCM_CHECK=${SCM_CHECK:=true} + SCM_THEME_PROMPT_DIRTY=' ✗' SCM_THEME_PROMPT_CLEAN=' ✓' SCM_THEME_PROMPT_PREFIX=' |' @@ -31,7 +34,9 @@ RBFU_THEME_PROMPT_PREFIX=' |' RBFU_THEME_PROMPT_SUFFIX='|' function scm { - if [[ -f .git/HEAD ]]; then SCM=$SCM_GIT + + if [[ "$SCM_CHECK" = false ]]; then SCM=$SCM_NONE + elif [[ -f .git/HEAD ]]; then SCM=$SCM_GIT elif which git &> /dev/null && [[ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]]; then SCM=$SCM_GIT elif [[ -d .hg ]]; then SCM=$SCM_HG elif which hg &> /dev/null && [[ -n "$(hg root 2> /dev/null)" ]]; then SCM=$SCM_HG From e100c159d1a1ded6eeb9609a57cc6e6e92882069 Mon Sep 17 00:00:00 2001 From: "Carlos E. Reynosa-Nunez" Date: Sat, 4 Oct 2014 17:35:15 -0700 Subject: [PATCH 2/4] Added the base theme version control status check flag to the template bash profile. This will allow for easy changing of the flag's value without needing to understand the base theme file. --- template/bash_profile.template.bash | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/template/bash_profile.template.bash b/template/bash_profile.template.bash index 60cac9ea..97394c34 100644 --- a/template/bash_profile.template.bash +++ b/template/bash_profile.template.bash @@ -32,9 +32,11 @@ unset MAILCHECK export IRC_CLIENT='irssi' # Set this to the command you use for todo.txt-cli - export TODO="t" +# Set this to false to turn of version control status checking within the prompt for all themes +export SCM_CHECK=true + # Set vcprompt executable path for scm advance info in prompt (demula theme) # https://github.com/xvzf/vcprompt #export VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt From a90aabf6f982589c43637e9af06d1a85d1528f09 Mon Sep 17 00:00:00 2001 From: "Carlos E. Reynosa-Nunez" Date: Sat, 4 Oct 2014 19:14:57 -0700 Subject: [PATCH 3/4] Fixed typo in comments. --- template/bash_profile.template.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/bash_profile.template.bash b/template/bash_profile.template.bash index 97394c34..d7937a47 100644 --- a/template/bash_profile.template.bash +++ b/template/bash_profile.template.bash @@ -34,7 +34,7 @@ export IRC_CLIENT='irssi' # Set this to the command you use for todo.txt-cli export TODO="t" -# Set this to false to turn of version control status checking within the prompt for all themes +# Set this to false to turn off version control status checking within the prompt for all themes export SCM_CHECK=true # Set vcprompt executable path for scm advance info in prompt (demula theme) From e318011894cffba449ebafc88d640148439b4400 Mon Sep 17 00:00:00 2001 From: Carlos Reynosa Date: Mon, 3 Nov 2014 15:02:56 -0800 Subject: [PATCH 4/4] Added SCM_CHECK flag documentation. --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index e07f632a..53fe7384 100644 --- a/README.md +++ b/README.md @@ -46,9 +46,26 @@ You can see the theme screenshots [here](https://github.com/revans/bash-it/wiki ## Misc +### Bash Profile Aliases Bash it creates a 'reload' alias that makes it convenient to reload your bash profile when you make changes. +### 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. + +Bash it provides a flag (`SCM_CHECK`) within the `~/.bash_profile` file that turns off/on version control information checking and display within all themes. Version control checking is on by default unless explicitly turned off. + +Set `SCM_CHECK` to 'false' to **turn off** version control checks for all themes: + +* `export SCM_CHECK=false` + +Set `SCM_CHECK` to 'true' (the default value) to **turn on** version control checks for all themes: + +* `export SCM_CHECK=true` + +**NOTE:** +It is possible for themes to ignore the `SCM_CHECK` flag and query specific version control information directly. For example, themes that use functions like `git_prompt_vars` skip the `SCM_CHECK` flag to retrieve and display git prompt information. If you turned version control checking off and you still see version control information within your prompt, then functions like `git_prompt_vars` are most likely the reason why. + ## Help out I think everyone has their own custom scripts accumulated over time. And so, following in the footsteps of oh-my-zsh, bash it is a framework for easily customizing your bash shell. Everyone's got a custom toolbox, so let's start making them even better, **as a community!**