Merge pull request #168 from dolmen/optimize/sr,sl,sb
Optimize _lp_sr, _lp_sl, _lp_sb
This commit is contained in:
commit
0c580401bf
21
liquidprompt
21
liquidprompt
@ -711,7 +711,7 @@ _lp_git_branch_color()
|
|||||||
|
|
||||||
local branch
|
local branch
|
||||||
branch=$(_lp_git_branch)
|
branch=$(_lp_git_branch)
|
||||||
if [[ ! -z "$branch" ]] ; then
|
if [[ -n "$branch" ]] ; then
|
||||||
|
|
||||||
local GD
|
local GD
|
||||||
git diff --quiet >/dev/null 2>&1
|
git diff --quiet >/dev/null 2>&1
|
||||||
@ -803,7 +803,7 @@ _lp_hg_branch_color()
|
|||||||
local branch
|
local branch
|
||||||
local ret
|
local ret
|
||||||
branch=$(_lp_hg_branch)
|
branch=$(_lp_hg_branch)
|
||||||
if [[ ! -z "$branch" ]] ; then
|
if [[ -n "$branch" ]] ; then
|
||||||
|
|
||||||
local has_untracked
|
local has_untracked
|
||||||
has_untracked=$(hg status 2>/dev/null | grep '\(^\?\)' | wc -l)
|
has_untracked=$(hg status 2>/dev/null | grep '\(^\?\)' | wc -l)
|
||||||
@ -921,7 +921,7 @@ _lp_fossil_branch_color()
|
|||||||
local branch
|
local branch
|
||||||
branch=$(_lp_fossil_branch)
|
branch=$(_lp_fossil_branch)
|
||||||
|
|
||||||
if [[ ! -z "$branch" ]] ; then
|
if [[ -n "$branch" ]] ; then
|
||||||
local C2E # Modified files (added or edited)
|
local C2E # Modified files (added or edited)
|
||||||
local C2D # Deleted files
|
local C2D # Deleted files
|
||||||
local C2A # Extras files
|
local C2A # Extras files
|
||||||
@ -1000,7 +1000,7 @@ _lp_bzr_branch_color()
|
|||||||
local revno=${tuple[1]}
|
local revno=${tuple[1]}
|
||||||
local clean=${tuple[2]}
|
local clean=${tuple[2]}
|
||||||
|
|
||||||
if [[ ! -z "$branch" ]] ; then
|
if [[ -n "$branch" ]] ; then
|
||||||
if [[ "$clean" -eq 0 ]] ; then
|
if [[ "$clean" -eq 0 ]] ; then
|
||||||
ret="${LP_COLOR_CHANGES}${branch}${NO_COL}(${LP_COLOR_COMMITS}$revno${NO_COL})"
|
ret="${LP_COLOR_CHANGES}${branch}${NO_COL}(${LP_COLOR_COMMITS}$revno${NO_COL})"
|
||||||
else
|
else
|
||||||
@ -1325,26 +1325,19 @@ _lp_smart_mark()
|
|||||||
# insert a space on the right
|
# insert a space on the right
|
||||||
_lp_sr()
|
_lp_sr()
|
||||||
{
|
{
|
||||||
if [[ ! -z "$1" ]] ; then
|
[[ -n "$1" ]] && echo -n "$1 "
|
||||||
echo -n "$1 "
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# insert a space on the left
|
# insert a space on the left
|
||||||
_lp_sl()
|
_lp_sl()
|
||||||
{
|
{
|
||||||
if [[ ! -z "$1" ]] ; then
|
[[ -n "$1" ]] && echo -n " $1"
|
||||||
echo -n " $1"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# insert two space, before and after
|
# insert two space, before and after
|
||||||
_lp_sb()
|
_lp_sb()
|
||||||
{
|
{
|
||||||
if [[ ! -z "$1" ]] ; then
|
[[ -n "$1" ]] && echo -n " $1 "
|
||||||
echo -n " $1 "
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
###################
|
###################
|
||||||
|
Loading…
Reference in New Issue
Block a user