mirror of
https://github.com/oh-my-fish/oh-my-fish
synced 2024-11-03 15:40:32 +00:00
[bobthefish] Simplify bold segments.
Add support for --bold (and --underline) to the __bobthefish_start_segment function.
This commit is contained in:
parent
4012de608d
commit
a81b1fcc2c
@ -111,24 +111,30 @@ end
|
|||||||
# ===========================
|
# ===========================
|
||||||
|
|
||||||
function __bobthefish_start_segment -d 'Start a prompt segment'
|
function __bobthefish_start_segment -d 'Start a prompt segment'
|
||||||
set_color -b $argv[1]
|
set -l bg $argv[1]
|
||||||
set_color $argv[2]
|
set -e argv[1]
|
||||||
|
set -l fg $argv[1]
|
||||||
|
set -e argv[1]
|
||||||
|
|
||||||
|
set_color normal # clear out anything bold or underline...
|
||||||
|
set_color -b $bg
|
||||||
|
set_color $fg $argv
|
||||||
if [ "$__bobthefish_current_bg" = 'NONE' ]
|
if [ "$__bobthefish_current_bg" = 'NONE' ]
|
||||||
# If there's no background, just start one
|
# If there's no background, just start one
|
||||||
echo -n ' '
|
echo -n ' '
|
||||||
else
|
else
|
||||||
# If there's already a background...
|
# If there's already a background...
|
||||||
if [ "$argv[1]" = "$__bobthefish_current_bg" ]
|
if [ "$bg" = "$__bobthefish_current_bg" ]
|
||||||
# and it's the same color, draw a separator
|
# and it's the same color, draw a separator
|
||||||
echo -n "$__bobthefish_right_arrow_glyph "
|
echo -n "$__bobthefish_right_arrow_glyph "
|
||||||
else
|
else
|
||||||
# otherwise, draw the end of the previous segment and the start of the next
|
# otherwise, draw the end of the previous segment and the start of the next
|
||||||
set_color $__bobthefish_current_bg
|
set_color $__bobthefish_current_bg
|
||||||
echo -n "$__bobthefish_right_black_arrow_glyph "
|
echo -n "$__bobthefish_right_black_arrow_glyph "
|
||||||
set_color $argv[2]
|
set_color $fg $argv
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
set __bobthefish_current_bg $argv[1]
|
set __bobthefish_current_bg $bg
|
||||||
end
|
end
|
||||||
|
|
||||||
function __bobthefish_path_segment -d 'Display a shortened form of a directory'
|
function __bobthefish_path_segment -d 'Display a shortened form of a directory'
|
||||||
@ -244,8 +250,7 @@ function __bobthefish_prompt_hg -d 'Display the actual hg state'
|
|||||||
__bobthefish_start_segment $flag_bg $flag_fg
|
__bobthefish_start_segment $flag_bg $flag_fg
|
||||||
echo -n -s $__bobthefish_hg_glyph ' '
|
echo -n -s $__bobthefish_hg_glyph ' '
|
||||||
|
|
||||||
__bobthefish_start_segment $flag_bg $flag_fg
|
__bobthefish_start_segment $flag_bg $flag_fg --bold
|
||||||
set_color $flag_fg --bold
|
|
||||||
echo -n -s (__bobthefish_hg_branch) $flags ' '
|
echo -n -s (__bobthefish_hg_branch) $flags ' '
|
||||||
set_color normal
|
set_color normal
|
||||||
|
|
||||||
@ -288,8 +293,7 @@ function __bobthefish_prompt_git -d 'Display the actual git state'
|
|||||||
|
|
||||||
__bobthefish_path_segment $argv[1]
|
__bobthefish_path_segment $argv[1]
|
||||||
|
|
||||||
__bobthefish_start_segment $flag_bg $flag_fg
|
__bobthefish_start_segment $flag_bg $flag_fg --bold
|
||||||
set_color $flag_fg --bold
|
|
||||||
echo -n -s (__bobthefish_git_branch) $flags ' '
|
echo -n -s (__bobthefish_git_branch) $flags ' '
|
||||||
set_color normal
|
set_color normal
|
||||||
|
|
||||||
@ -328,8 +332,7 @@ function __bobthefish_prompt_virtualfish -d "Display activated virtual environme
|
|||||||
__bobthefish_start_segment $__bobthefish_med_blue $__bobthefish_lt_grey
|
__bobthefish_start_segment $__bobthefish_med_blue $__bobthefish_lt_grey
|
||||||
echo -n -s $__bobthefish_virtualenv_glyph $version_glyph
|
echo -n -s $__bobthefish_virtualenv_glyph $version_glyph
|
||||||
end
|
end
|
||||||
__bobthefish_start_segment $__bobthefish_med_blue $__bobthefish_lt_grey
|
__bobthefish_start_segment $__bobthefish_med_blue $__bobthefish_lt_grey --bold
|
||||||
set_color $__bobthefish_lt_grey --bold
|
|
||||||
echo -n -s (basename "$VIRTUAL_ENV") ' '
|
echo -n -s (basename "$VIRTUAL_ENV") ' '
|
||||||
set_color normal
|
set_color normal
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user