mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
themes/agnoster: Change indentation
This commit is contained in:
@@ -145,9 +145,9 @@ OMB_PROMPT_SHOW_PYTHON_VENV=${OMB_PROMPT_SHOW_PYTHON_VENV:=true}
|
|||||||
######################################################################
|
######################################################################
|
||||||
DEBUG=0
|
DEBUG=0
|
||||||
function debug {
|
function debug {
|
||||||
if [[ ${DEBUG} -ne 0 ]]; then
|
if [[ ${DEBUG} -ne 0 ]]; then
|
||||||
>&2 echo -e $*
|
>&2 echo -e $*
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
@@ -162,123 +162,123 @@ LEFT_SUBSEG=''
|
|||||||
RIGHT_SUBSEG=''
|
RIGHT_SUBSEG=''
|
||||||
|
|
||||||
function text_effect {
|
function text_effect {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
reset) echo 0;;
|
reset) echo 0;;
|
||||||
bold) echo 1;;
|
bold) echo 1;;
|
||||||
underline) echo 4;;
|
underline) echo 4;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# to add colors, see
|
# to add colors, see
|
||||||
# http://bitmote.com/index.php?post/2012/11/19/Using-ANSI-Color-Codes-to-Colorize-Your-Bash-Prompt-on-Linux
|
# http://bitmote.com/index.php?post/2012/11/19/Using-ANSI-Color-Codes-to-Colorize-Your-Bash-Prompt-on-Linux
|
||||||
# under the "256 (8-bit) Colors" section, and follow the example for orange below
|
# under the "256 (8-bit) Colors" section, and follow the example for orange below
|
||||||
function fg_color {
|
function fg_color {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
black) echo 30;;
|
black) echo 30;;
|
||||||
red) echo 31;;
|
red) echo 31;;
|
||||||
green) echo 32;;
|
green) echo 32;;
|
||||||
yellow) echo 33;;
|
yellow) echo 33;;
|
||||||
blue) echo 34;;
|
blue) echo 34;;
|
||||||
magenta) echo 35;;
|
magenta) echo 35;;
|
||||||
cyan) echo 36;;
|
cyan) echo 36;;
|
||||||
white) echo 37;;
|
white) echo 37;;
|
||||||
orange) echo 38\;5\;166;;
|
orange) echo 38\;5\;166;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
function bg_color {
|
function bg_color {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
black) echo 40;;
|
black) echo 40;;
|
||||||
red) echo 41;;
|
red) echo 41;;
|
||||||
green) echo 42;;
|
green) echo 42;;
|
||||||
yellow) echo 43;;
|
yellow) echo 43;;
|
||||||
blue) echo 44;;
|
blue) echo 44;;
|
||||||
magenta) echo 45;;
|
magenta) echo 45;;
|
||||||
cyan) echo 46;;
|
cyan) echo 46;;
|
||||||
white) echo 47;;
|
white) echo 47;;
|
||||||
orange) echo 48\;5\;166;;
|
orange) echo 48\;5\;166;;
|
||||||
esac;
|
esac;
|
||||||
}
|
}
|
||||||
|
|
||||||
# TIL: declare is global not local, so best use a different name
|
# TIL: declare is global not local, so best use a different name
|
||||||
# for codes (mycodes) as otherwise it'll clobber the original.
|
# for codes (mycodes) as otherwise it'll clobber the original.
|
||||||
# this changes from BASH v3 to BASH v4.
|
# this changes from BASH v3 to BASH v4.
|
||||||
function ansi {
|
function ansi {
|
||||||
local seq
|
local seq
|
||||||
local -a mycodes=("${!1}")
|
local -a mycodes=("${!1}")
|
||||||
|
|
||||||
debug "ansi: ${!1} all: $* aka ${mycodes[@]}"
|
debug "ansi: ${!1} all: $* aka ${mycodes[@]}"
|
||||||
|
|
||||||
seq=""
|
seq=""
|
||||||
local i
|
local i
|
||||||
for ((i = 0; i < ${#mycodes[@]}; i++)); do
|
for ((i = 0; i < ${#mycodes[@]}; i++)); do
|
||||||
if [[ -n $seq ]]; then
|
if [[ -n $seq ]]; then
|
||||||
seq="${seq};"
|
seq="${seq};"
|
||||||
fi
|
fi
|
||||||
seq="${seq}${mycodes[$i]}"
|
seq="${seq}${mycodes[$i]}"
|
||||||
done
|
done
|
||||||
debug "ansi debug:" '\\[\\033['${seq}'m\\]'
|
debug "ansi debug:" '\\[\\033['${seq}'m\\]'
|
||||||
echo -ne '\[\033['${seq}'m\]'
|
echo -ne '\[\033['${seq}'m\]'
|
||||||
# PR="$PR\[\033[${seq}m\]"
|
# PR="$PR\[\033[${seq}m\]"
|
||||||
}
|
}
|
||||||
|
|
||||||
function ansi_single {
|
function ansi_single {
|
||||||
echo -ne '\[\033['$1'm\]'
|
echo -ne '\[\033['$1'm\]'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Begin a segment
|
# Begin a segment
|
||||||
# Takes two arguments, background and foreground. Both can be omitted,
|
# Takes two arguments, background and foreground. Both can be omitted,
|
||||||
# rendering default background/foreground.
|
# rendering default background/foreground.
|
||||||
function prompt_segment {
|
function prompt_segment {
|
||||||
local bg fg
|
local bg fg
|
||||||
local -a codes
|
local -a codes
|
||||||
|
|
||||||
debug "Prompting $1 $2 $3"
|
debug "Prompting $1 $2 $3"
|
||||||
|
|
||||||
# if commented out from kruton's original... I'm not clear
|
# if commented out from kruton's original... I'm not clear
|
||||||
# if it did anything, but it messed up things like
|
# if it did anything, but it messed up things like
|
||||||
# prompt_status - Erik 1/14/17
|
# prompt_status - Erik 1/14/17
|
||||||
|
|
||||||
# if [[ -z $1 || ( -z $2 && $2 != default ) ]]; then
|
# if [[ -z $1 || ( -z $2 && $2 != default ) ]]; then
|
||||||
codes=("${codes[@]}" $(text_effect reset))
|
codes=("${codes[@]}" $(text_effect reset))
|
||||||
# fi
|
# fi
|
||||||
if [[ -n $1 ]]; then
|
if [[ -n $1 ]]; then
|
||||||
bg=$(bg_color $1)
|
bg=$(bg_color $1)
|
||||||
codes=("${codes[@]}" $bg)
|
codes=("${codes[@]}" $bg)
|
||||||
debug "Added $bg as background to codes"
|
debug "Added $bg as background to codes"
|
||||||
fi
|
fi
|
||||||
if [[ -n $2 ]]; then
|
if [[ -n $2 ]]; then
|
||||||
fg=$(fg_color $2)
|
fg=$(fg_color $2)
|
||||||
codes=("${codes[@]}" $fg)
|
codes=("${codes[@]}" $fg)
|
||||||
debug "Added $fg as foreground to codes"
|
debug "Added $fg as foreground to codes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
debug "Codes: "
|
debug "Codes: "
|
||||||
# local -p codes
|
# local -p codes
|
||||||
|
|
||||||
if [[ $CURRENT_BG != NONE && $1 != $CURRENT_BG ]]; then
|
if [[ $CURRENT_BG != NONE && $1 != $CURRENT_BG ]]; then
|
||||||
local -a intermediate=($(fg_color $CURRENT_BG) $(bg_color $1))
|
local -a intermediate=($(fg_color $CURRENT_BG) $(bg_color $1))
|
||||||
debug "pre prompt " $(ansi intermediate[@])
|
debug "pre prompt " $(ansi intermediate[@])
|
||||||
PR="$PR $(ansi intermediate[@])$SEGMENT_SEPARATOR"
|
PR="$PR $(ansi intermediate[@])$SEGMENT_SEPARATOR"
|
||||||
debug "post prompt " $(ansi codes[@])
|
debug "post prompt " $(ansi codes[@])
|
||||||
PR="$PR$(ansi codes[@]) "
|
PR="$PR$(ansi codes[@]) "
|
||||||
else
|
else
|
||||||
debug "no current BG, codes is $codes[@]"
|
debug "no current BG, codes is $codes[@]"
|
||||||
PR="$PR$(ansi codes[@]) "
|
PR="$PR$(ansi codes[@]) "
|
||||||
fi
|
fi
|
||||||
CURRENT_BG=$1
|
CURRENT_BG=$1
|
||||||
[[ -n $3 ]] && PR="$PR$3"
|
[[ -n $3 ]] && PR="$PR$3"
|
||||||
}
|
}
|
||||||
|
|
||||||
# End the prompt, closing any open segments
|
# End the prompt, closing any open segments
|
||||||
function prompt_end {
|
function prompt_end {
|
||||||
if [[ -n $CURRENT_BG ]]; then
|
if [[ -n $CURRENT_BG ]]; then
|
||||||
local -a codes=($(text_effect reset) $(fg_color $CURRENT_BG))
|
local -a codes=($(text_effect reset) $(fg_color $CURRENT_BG))
|
||||||
PR="$PR $(ansi codes[@])$SEGMENT_SEPARATOR"
|
PR="$PR $(ansi codes[@])$SEGMENT_SEPARATOR"
|
||||||
fi
|
fi
|
||||||
local -a reset=($(text_effect reset))
|
local -a reset=($(text_effect reset))
|
||||||
PR="$PR $(ansi reset[@])"
|
PR="$PR $(ansi reset[@])"
|
||||||
CURRENT_BG=''
|
CURRENT_BG=''
|
||||||
}
|
}
|
||||||
|
|
||||||
### virtualenv prompt
|
### virtualenv prompt
|
||||||
@@ -312,88 +312,88 @@ function prompt_condaenv {
|
|||||||
|
|
||||||
# Context: user@hostname (who am I and where am I)
|
# Context: user@hostname (who am I and where am I)
|
||||||
function prompt_context {
|
function prompt_context {
|
||||||
local user=$(whoami)
|
local user=$(whoami)
|
||||||
|
|
||||||
if [[ $user != $DEFAULT_USER || -n $SSH_CLIENT ]]; then
|
if [[ $user != $DEFAULT_USER || -n $SSH_CLIENT ]]; then
|
||||||
prompt_segment black default "$user@\h"
|
prompt_segment black default "$user@\h"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# prints history followed by HH:MM, useful for remembering what
|
# prints history followed by HH:MM, useful for remembering what
|
||||||
# we did previously
|
# we did previously
|
||||||
function prompt_histdt {
|
function prompt_histdt {
|
||||||
prompt_segment black default "\! [\A]"
|
prompt_segment black default "\! [\A]"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function git_status_dirty {
|
function git_status_dirty {
|
||||||
dirty=$(git status -s 2> /dev/null | tail -n 1)
|
dirty=$(git status -s 2> /dev/null | tail -n 1)
|
||||||
[[ -n $dirty ]] && echo " ●"
|
[[ -n $dirty ]] && echo " ●"
|
||||||
}
|
}
|
||||||
|
|
||||||
function git_stash_dirty {
|
function git_stash_dirty {
|
||||||
stash=$(git stash list 2> /dev/null | tail -n 1)
|
stash=$(git stash list 2> /dev/null | tail -n 1)
|
||||||
[[ -n $stash ]] && echo " ⚑"
|
[[ -n $stash ]] && echo " ⚑"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Git: branch/detached head, dirty status
|
# Git: branch/detached head, dirty status
|
||||||
function prompt_git {
|
function prompt_git {
|
||||||
local ref dirty
|
local ref dirty
|
||||||
if git rev-parse --is-inside-work-tree &>/dev/null; then
|
if git rev-parse --is-inside-work-tree &>/dev/null; then
|
||||||
ZSH_THEME_GIT_PROMPT_DIRTY='±'
|
ZSH_THEME_GIT_PROMPT_DIRTY='±'
|
||||||
dirty=$(git_status_dirty)
|
dirty=$(git_status_dirty)
|
||||||
stash=$(git_stash_dirty)
|
stash=$(git_stash_dirty)
|
||||||
ref=$(git symbolic-ref HEAD 2> /dev/null) ||
|
ref=$(git symbolic-ref HEAD 2> /dev/null) ||
|
||||||
ref="➦ $(git describe --exact-match --tags HEAD 2> /dev/null)" ||
|
ref="➦ $(git describe --exact-match --tags HEAD 2> /dev/null)" ||
|
||||||
ref="➦ $(git show-ref --head -s --abbrev | head -n1 2> /dev/null)"
|
ref="➦ $(git show-ref --head -s --abbrev | head -n1 2> /dev/null)"
|
||||||
if [[ -n $dirty ]]; then
|
if [[ -n $dirty ]]; then
|
||||||
prompt_segment yellow black
|
prompt_segment yellow black
|
||||||
else
|
else
|
||||||
prompt_segment green black
|
prompt_segment green black
|
||||||
fi
|
|
||||||
PR="$PR${ref/refs\/heads\// }$stash$dirty"
|
|
||||||
fi
|
fi
|
||||||
|
PR="$PR${ref/refs\/heads\// }$stash$dirty"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Mercurial: clean, modified and uncomitted files
|
# Mercurial: clean, modified and uncomitted files
|
||||||
function prompt_hg {
|
function prompt_hg {
|
||||||
local rev st branch
|
local rev st branch
|
||||||
if $(hg id >/dev/null 2>&1); then
|
if $(hg id >/dev/null 2>&1); then
|
||||||
if $(hg prompt >/dev/null 2>&1); then
|
if $(hg prompt >/dev/null 2>&1); then
|
||||||
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
|
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
|
||||||
# if files are not added
|
# if files are not added
|
||||||
prompt_segment red white
|
prompt_segment red white
|
||||||
st='±'
|
st='±'
|
||||||
elif [[ -n $(hg prompt "{status|modified}") ]]; then
|
elif [[ -n $(hg prompt "{status|modified}") ]]; then
|
||||||
# if any modification
|
# if any modification
|
||||||
prompt_segment yellow black
|
prompt_segment yellow black
|
||||||
st='±'
|
st='±'
|
||||||
else
|
else
|
||||||
# if working copy is clean
|
# if working copy is clean
|
||||||
prompt_segment green black $CURRENT_FG
|
prompt_segment green black $CURRENT_FG
|
||||||
fi
|
fi
|
||||||
PR="$PR$(hg prompt "☿ {rev}@{branch}") $st"
|
PR="$PR$(hg prompt "☿ {rev}@{branch}") $st"
|
||||||
else
|
else
|
||||||
st=""
|
st=""
|
||||||
rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
|
rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
|
||||||
branch=$(hg id -b 2>/dev/null)
|
branch=$(hg id -b 2>/dev/null)
|
||||||
if `hg st | grep -q "^\?"`; then
|
if `hg st | grep -q "^\?"`; then
|
||||||
prompt_segment red white
|
prompt_segment red white
|
||||||
st='±'
|
st='±'
|
||||||
elif `hg st | grep -q "^[MA]"`; then
|
elif `hg st | grep -q "^[MA]"`; then
|
||||||
prompt_segment yellow black
|
prompt_segment yellow black
|
||||||
st='±'
|
st='±'
|
||||||
else
|
else
|
||||||
prompt_segment green black $CURRENT_FG
|
prompt_segment green black $CURRENT_FG
|
||||||
fi
|
fi
|
||||||
PR="$PR☿ $rev@$branch $st"
|
PR="$PR☿ $rev@$branch $st"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Dir: current working directory
|
# Dir: current working directory
|
||||||
function prompt_dir {
|
function prompt_dir {
|
||||||
prompt_segment blue black '\w'
|
prompt_segment blue black '\w'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Status:
|
# Status:
|
||||||
@@ -401,13 +401,13 @@ function prompt_dir {
|
|||||||
# - am I root
|
# - am I root
|
||||||
# - are there background jobs?
|
# - are there background jobs?
|
||||||
function prompt_status {
|
function prompt_status {
|
||||||
local symbols
|
local symbols
|
||||||
symbols=()
|
symbols=()
|
||||||
[[ $RETVAL -ne 0 ]] && symbols+="$(ansi_single $(fg_color red))✘"
|
[[ $RETVAL -ne 0 ]] && symbols+="$(ansi_single $(fg_color red))✘"
|
||||||
[[ $UID -eq 0 ]] && symbols+="$(ansi_single $(fg_color yellow))⚡"
|
[[ $UID -eq 0 ]] && symbols+="$(ansi_single $(fg_color yellow))⚡"
|
||||||
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="$(ansi_single $(fg_color cyan))⚙"
|
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="$(ansi_single $(fg_color cyan))⚙"
|
||||||
|
|
||||||
[[ -n "$symbols" ]] && prompt_segment black default "$symbols"
|
[[ -n "$symbols" ]] && prompt_segment black default "$symbols"
|
||||||
}
|
}
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
@@ -417,89 +417,89 @@ function prompt_status {
|
|||||||
# doesn't quite work per above
|
# doesn't quite work per above
|
||||||
|
|
||||||
function rightprompt {
|
function rightprompt {
|
||||||
printf "%*s" $COLUMNS "$PRIGHT"
|
printf "%*s" $COLUMNS "$PRIGHT"
|
||||||
}
|
}
|
||||||
|
|
||||||
# quick right prompt I grabbed to test things.
|
# quick right prompt I grabbed to test things.
|
||||||
function __command_rprompt {
|
function __command_rprompt {
|
||||||
local times= n=$COLUMNS tz
|
local times= n=$COLUMNS tz
|
||||||
for tz in ZRH:Europe/Zurich PIT:US/Eastern \
|
for tz in ZRH:Europe/Zurich PIT:US/Eastern \
|
||||||
MTV:US/Pacific TOK:Asia/Tokyo; do
|
MTV:US/Pacific TOK:Asia/Tokyo; do
|
||||||
[ $n -gt 40 ] || break
|
[ $n -gt 40 ] || break
|
||||||
times="$times ${tz%%:*}\e[30;1m:\e[0;36;1m"
|
times="$times ${tz%%:*}\e[30;1m:\e[0;36;1m"
|
||||||
times="$times$(TZ=${tz#*:} date +%H:%M)\e[0m"
|
times="$times$(TZ=${tz#*:} date +%H:%M)\e[0m"
|
||||||
n=$(( $n - 10 ))
|
n=$(( $n - 10 ))
|
||||||
done
|
done
|
||||||
[ -z "$times" ] || printf "%${n}s$times\\r" ''
|
[ -z "$times" ] || printf "%${n}s$times\\r" ''
|
||||||
}
|
}
|
||||||
|
|
||||||
# this doens't wrap code in \[ \]
|
# this doens't wrap code in \[ \]
|
||||||
function ansi_r {
|
function ansi_r {
|
||||||
local seq
|
local seq
|
||||||
local -a mycodes2=("${!1}")
|
local -a mycodes2=("${!1}")
|
||||||
|
|
||||||
debug "ansi: ${!1} all: $* aka ${mycodes2[@]}"
|
debug "ansi: ${!1} all: $* aka ${mycodes2[@]}"
|
||||||
|
|
||||||
seq=""
|
seq=""
|
||||||
local i
|
local i
|
||||||
for ((i = 0; i < ${#mycodes2[@]}; i++)); do
|
for ((i = 0; i < ${#mycodes2[@]}; i++)); do
|
||||||
if [[ -n $seq ]]; then
|
if [[ -n $seq ]]; then
|
||||||
seq="${seq};"
|
seq="${seq};"
|
||||||
fi
|
fi
|
||||||
seq="${seq}${mycodes2[$i]}"
|
seq="${seq}${mycodes2[$i]}"
|
||||||
done
|
done
|
||||||
debug "ansi debug:" '\\[\\033['${seq}'m\\]'
|
debug "ansi debug:" '\\[\\033['${seq}'m\\]'
|
||||||
echo -ne '\033['${seq}'m'
|
echo -ne '\033['${seq}'m'
|
||||||
# PR="$PR\[\033[${seq}m\]"
|
# PR="$PR\[\033[${seq}m\]"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Begin a segment on the right
|
# Begin a segment on the right
|
||||||
# Takes two arguments, background and foreground. Both can be omitted,
|
# Takes two arguments, background and foreground. Both can be omitted,
|
||||||
# rendering default background/foreground.
|
# rendering default background/foreground.
|
||||||
function prompt_right_segment {
|
function prompt_right_segment {
|
||||||
local bg fg
|
local bg fg
|
||||||
local -a codes
|
local -a codes
|
||||||
|
|
||||||
debug "Prompt right"
|
debug "Prompt right"
|
||||||
debug "Prompting $1 $2 $3"
|
debug "Prompting $1 $2 $3"
|
||||||
|
|
||||||
# if commented out from kruton's original... I'm not clear
|
# if commented out from kruton's original... I'm not clear
|
||||||
# if it did anything, but it messed up things like
|
# if it did anything, but it messed up things like
|
||||||
# prompt_status - Erik 1/14/17
|
# prompt_status - Erik 1/14/17
|
||||||
|
|
||||||
# if [[ -z $1 || ( -z $2 && $2 != default ) ]]; then
|
# if [[ -z $1 || ( -z $2 && $2 != default ) ]]; then
|
||||||
codes=("${codes[@]}" $(text_effect reset))
|
codes=("${codes[@]}" $(text_effect reset))
|
||||||
# fi
|
# fi
|
||||||
if [[ -n $1 ]]; then
|
if [[ -n $1 ]]; then
|
||||||
bg=$(bg_color $1)
|
bg=$(bg_color $1)
|
||||||
codes=("${codes[@]}" $bg)
|
codes=("${codes[@]}" $bg)
|
||||||
debug "Added $bg as background to codes"
|
debug "Added $bg as background to codes"
|
||||||
fi
|
fi
|
||||||
if [[ -n $2 ]]; then
|
if [[ -n $2 ]]; then
|
||||||
fg=$(fg_color $2)
|
fg=$(fg_color $2)
|
||||||
codes=("${codes[@]}" $fg)
|
codes=("${codes[@]}" $fg)
|
||||||
debug "Added $fg as foreground to codes"
|
debug "Added $fg as foreground to codes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
debug "Right Codes: "
|
debug "Right Codes: "
|
||||||
# local -p codes
|
# local -p codes
|
||||||
|
|
||||||
# right always has a separator
|
# right always has a separator
|
||||||
# if [[ $CURRENT_RBG != NONE && $1 != $CURRENT_RBG ]]; then
|
# if [[ $CURRENT_RBG != NONE && $1 != $CURRENT_RBG ]]; then
|
||||||
# $CURRENT_RBG=
|
# $CURRENT_RBG=
|
||||||
# fi
|
# fi
|
||||||
local -a intermediate2=($(fg_color $1) $(bg_color $CURRENT_RBG) )
|
local -a intermediate2=($(fg_color $1) $(bg_color $CURRENT_RBG) )
|
||||||
# PRIGHT="$PRIGHT---"
|
# PRIGHT="$PRIGHT---"
|
||||||
debug "pre prompt " $(ansi_r intermediate2[@])
|
debug "pre prompt " $(ansi_r intermediate2[@])
|
||||||
PRIGHT="$PRIGHT$(ansi_r intermediate2[@])$RIGHT_SEPARATOR"
|
PRIGHT="$PRIGHT$(ansi_r intermediate2[@])$RIGHT_SEPARATOR"
|
||||||
debug "post prompt " $(ansi_r codes[@])
|
debug "post prompt " $(ansi_r codes[@])
|
||||||
PRIGHT="$PRIGHT$(ansi_r codes[@]) "
|
PRIGHT="$PRIGHT$(ansi_r codes[@]) "
|
||||||
# else
|
# else
|
||||||
# debug "no current BG, codes is $codes[@]"
|
# debug "no current BG, codes is $codes[@]"
|
||||||
# PRIGHT="$PRIGHT$(ansi codes[@]) "
|
# PRIGHT="$PRIGHT$(ansi codes[@]) "
|
||||||
# fi
|
# fi
|
||||||
CURRENT_RBG=$1
|
CURRENT_RBG=$1
|
||||||
[[ -n $3 ]] && PRIGHT="$PRIGHT$3"
|
[[ -n $3 ]] && PRIGHT="$PRIGHT$3"
|
||||||
}
|
}
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
@@ -520,26 +520,26 @@ function prompt_right_segment {
|
|||||||
# 'dirtrack-filter-out-pwd-prompt t t)))
|
# 'dirtrack-filter-out-pwd-prompt t t)))
|
||||||
|
|
||||||
function prompt_emacsdir {
|
function prompt_emacsdir {
|
||||||
# no color or other setting... this will be deleted per above
|
# no color or other setting... this will be deleted per above
|
||||||
PR="DIR \w DIR$PR"
|
PR="DIR \w DIR$PR"
|
||||||
}
|
}
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
## Main prompt
|
## Main prompt
|
||||||
|
|
||||||
function build_prompt {
|
function build_prompt {
|
||||||
[[ ! -z ${AG_EMACS_DIR+x} ]] && prompt_emacsdir
|
[[ ! -z ${AG_EMACS_DIR+x} ]] && prompt_emacsdir
|
||||||
prompt_status
|
prompt_status
|
||||||
#[[ -z ${AG_NO_HIST+x} ]] && prompt_histdt
|
#[[ -z ${AG_NO_HIST+x} ]] && prompt_histdt
|
||||||
[[ -z ${AG_NO_CONTEXT+x} ]] && prompt_context
|
[[ -z ${AG_NO_CONTEXT+x} ]] && prompt_context
|
||||||
if [[ ${OMB_PROMPT_SHOW_PYTHON_VENV-} ]]; then
|
if [[ ${OMB_PROMPT_SHOW_PYTHON_VENV-} ]]; then
|
||||||
prompt_virtualenv
|
prompt_virtualenv
|
||||||
prompt_condaenv
|
prompt_condaenv
|
||||||
fi
|
fi
|
||||||
prompt_dir
|
prompt_dir
|
||||||
prompt_git
|
prompt_git
|
||||||
prompt_hg
|
prompt_hg
|
||||||
prompt_end
|
prompt_end
|
||||||
}
|
}
|
||||||
|
|
||||||
# from orig...
|
# from orig...
|
||||||
@@ -548,14 +548,14 @@ function build_prompt {
|
|||||||
# use that.
|
# use that.
|
||||||
|
|
||||||
function _omb_theme_PROMPT_COMMAND {
|
function _omb_theme_PROMPT_COMMAND {
|
||||||
local RETVAL=$?
|
local RETVAL=$?
|
||||||
local PRIGHT=""
|
local PRIGHT=""
|
||||||
local CURRENT_BG=NONE
|
local CURRENT_BG=NONE
|
||||||
local PR="$(ansi_single $(text_effect reset))"
|
local PR="$(ansi_single $(text_effect reset))"
|
||||||
build_prompt
|
build_prompt
|
||||||
|
|
||||||
# uncomment below to use right prompt
|
# uncomment below to use right prompt
|
||||||
# PS1='\[$(tput sc; printf "%*s" $COLUMNS "$PRIGHT"; tput rc)\]'$PR
|
# PS1='\[$(tput sc; printf "%*s" $COLUMNS "$PRIGHT"; tput rc)\]'$PR
|
||||||
PS1=$PR
|
PS1=$PR
|
||||||
}
|
}
|
||||||
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND
|
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND
|
||||||
|
|||||||
Reference in New Issue
Block a user