Avoiding the if statements, using exit code of `grep -q` instead.
Reverted the change that adds a space after the AC char. Opting for a
default value, allowing to override from one's profile.
bash-it takes rather a while to startup, around 0.5 seconds on my
laptop. After a bit of timing it appears the majority of the time is
spent in themes/colors.theme.bash. The reason for that is the fancy
abstraction layers that use $(). For example, consider this code:
red="$(color reset red)"
It will go through 9 forkexecs to evaluate:
red="$(color reset red)"
"$(__color_parse make_ansi reset red)"
"$(__make_ansi reset red)"
"\[\e[$(__reset red)m\]"
"\[\e[0;$(__red)m\]"
"\[\e[0;$(__color red)m\]"
"\[\e[0;$(__color_normal_fg $(__color_red))m\]"
"\[\e[0;$(__color_normal_fg 1)m\]"
"\[\e[0;31m\]"
With all the variables in colors.theme.bash, this adds up to hundreds of
forks:
$ strace -f bash ./colors.theme.bash 2>&1 | grep clone | wc -l
649
The solution is to replace the function with its result:
-red="$(color reset red)"
+red='\[\e[0;31m\]'
This is safe, since colors.theme.bash never calls external functions or
takes any input. So, its result can be safely hard-coded.
This improves startup time dramatically. Try adding "time" to your .bashrc:
# Load Bash It
time source $BASH_IT/bash_it.sh
before:
real 0m0.462s
user 0m0.100s
sys 0m0.399s
after:
real 0m0.150s
user 0m0.091s
sys 0m0.064s
This change allows for the capture of the expanded prompt (rather than the raw `PS1`) so that
it is easier to maintain context when changing directories.
Fix is based on the comments from [this stackoverflow](http://stackoverflow.com/a/24006864)
- Added more information to the README about the practice of using `git
pair`, and provided instructions on installing the support.
- Write a more reliable fallback that uses `user.name` to extract user
initials, when `user.initials` aren't set.
Running `rvm tools identifier` seems to be really slow. Using [`rvm-prompt`](https://rvm.io/workflow/prompt) greatly speeds up the evaluation of `$PROMPT_COMMAND`.
- New env var (THEME_PROMPT_USERINFO_MODE) to choose "user info" mode:
Possible values:
default: same behaviour as before
sudo: only show a "hint" when sudo credentials are cached
any other values disables this segment.