diff --git a/fish_prompt.fish b/fish_prompt.fish index e72d0ad..8252295 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -15,40 +15,40 @@ # set -g theme_display_user yes # set -g default_user your_normal_user -set -g current_bg NONE +set -g __bobthefish_current_bg NONE # Powerline glyphs -set branch_glyph \uE0A0 -set ln_glyph \uE0A1 -set padlock_glyph \uE0A2 -set right_black_arrow_glyph \uE0B0 -set right_arrow_glyph \uE0B1 -set left_black_arrow_glyph \uE0B2 -set left_arrow_glyph \uE0B3 +set __bobthefish_branch_glyph \uE0A0 +set __bobthefish_ln_glyph \uE0A1 +set __bobthefish_padlock_glyph \uE0A2 +set __bobthefish_right_black_arrow_glyph \uE0B0 +set __bobthefish_right_arrow_glyph \uE0B1 +set __bobthefish_left_black_arrow_glyph \uE0B2 +set __bobthefish_left_arrow_glyph \uE0B3 # Additional glyphs -set detached_glyph \u27A6 -set nonzero_exit_glyph '! ' -set superuser_glyph '$ ' -set bg_job_glyph '% ' +set __bobthefish_detached_glyph \u27A6 +set __bobthefish_nonzero_exit_glyph '! ' +set __bobthefish_superuser_glyph '$ ' +set __bobthefish_bg_job_glyph '% ' # Colors -set lt_green addc10 -set med_green 189303 -set dk_green 0c4801 +set __bobthefish_lt_green addc10 +set __bobthefish_med_green 189303 +set __bobthefish_dk_green 0c4801 -set lt_red C99 -set med_red ce000f -set dk_red 600 +set __bobthefish_lt_red C99 +set __bobthefish_med_red ce000f +set __bobthefish_dk_red 600 -set slate_blue 255e87 +set __bobthefish_slate_blue 255e87 -set lt_orange f6b117 -set dk_orange 3a2a03 +set __bobthefish_lt_orange f6b117 +set __bobthefish_dk_orange 3a2a03 -set dk_grey 333 -set med_grey 999 -set lt_grey ccc +set __bobthefish_dk_grey 333 +set __bobthefish_med_grey 999 +set __bobthefish_lt_grey ccc # =========================== # Helper methods @@ -62,9 +62,9 @@ function __bobthefish_git_branch -d 'Get the current git branch (or commitish)' set -l ref (command git symbolic-ref HEAD 2> /dev/null) if [ $status -gt 0 ] set -l branch (command git show-ref --head -s --abbrev |head -n1 2> /dev/null) - set ref "$detached_glyph $branch" + set ref "$__bobthefish_detached_glyph $branch" end - echo $ref | sed "s-refs/heads/-$branch_glyph -" + echo $ref | sed "s-refs/heads/-$__bobthefish_branch_glyph -" end function __bobthefish_pretty_parent -d 'Print a parent directory, shortened to fit the prompt' @@ -88,29 +88,29 @@ end function __bobthefish_start_segment -d 'Start a prompt segment' set_color -b $argv[1] set_color $argv[2] - if [ "$current_bg" = 'NONE' ] + if [ "$__bobthefish_current_bg" = 'NONE' ] # If there's no background, just start one echo -n ' ' else # If there's already a background... - if [ "$argv[1]" = "$current_bg" ] + if [ "$argv[1]" = "$__bobthefish_current_bg" ] # and it's the same color, draw a separator - echo -n "$right_arrow_glyph " + echo -n "$__bobthefish_right_arrow_glyph " else # otherwise, draw the end of the previous segment and the start of the next - set_color $current_bg - echo -n "$right_black_arrow_glyph " + set_color $__bobthefish_current_bg + echo -n "$__bobthefish_right_black_arrow_glyph " set_color $argv[2] end end - set current_bg $argv[1] + set __bobthefish_current_bg $argv[1] end function __bobthefish_path_segment -d 'Display a shortened form of a directory' if test -w "$argv[1]" - __bobthefish_start_segment $dk_grey $med_grey + __bobthefish_start_segment $__bobthefish_dk_grey $__bobthefish_med_grey else - __bobthefish_start_segment $dk_red $lt_red + __bobthefish_start_segment $__bobthefish_dk_red $__bobthefish_lt_red end set -l directory @@ -134,13 +134,13 @@ function __bobthefish_path_segment -d 'Display a shortened form of a directory' end function __bobthefish_finish_segments -d 'Close open prompt segments' - if [ -n $current_bg -a $current_bg != 'NONE' ] + if [ -n $__bobthefish_current_bg -a $__bobthefish_current_bg != 'NONE' ] set_color -b normal - set_color $current_bg - echo -n "$right_black_arrow_glyph " + set_color $__bobthefish_current_bg + echo -n "$__bobthefish_right_black_arrow_glyph " set_color normal end - set -g current_bg NONE + set -g __bobthefish_current_bg NONE end @@ -155,18 +155,18 @@ function __bobthefish_prompt_status -d 'Display symbols for a non zero exit stat # Last exit was nonzero if [ $RETVAL -ne 0 ] - set nonzero $nonzero_exit_glyph + set nonzero $__bobthefish_nonzero_exit_glyph end # if superuser (uid == 0) set -l uid (id -u $USER) if [ $uid -eq 0 ] - set superuser $superuser_glyph + set superuser $__bobthefish_superuser_glyph end # Jobs display if [ (jobs -l | wc -l) -gt 0 ] - set bg_jobs $bg_job_glyph + set bg_jobs $__bobthefish_bg_job_glyph end set -l status_flags "$nonzero$superuser$bg_jobs" @@ -174,18 +174,18 @@ function __bobthefish_prompt_status -d 'Display symbols for a non zero exit stat if test "$nonzero" -o "$superuser" -o "$bg_jobs" __bobthefish_start_segment fff 000 if [ "$nonzero" ] - set_color $med_red --bold - echo -n $nonzero_exit_glyph + set_color $__bobthefish_med_red --bold + echo -n $__bobthefish_nonzero_exit_glyph end if [ "$superuser" ] - set_color $med_green --bold - echo -n $superuser_glyph + set_color $__bobthefish_med_green --bold + echo -n $__bobthefish_superuser_glyph end if [ "$bg_jobs" ] - set_color $slate_blue --bold - echo -n $bg_job_glyph + set_color $__bobthefish_slate_blue --bold + echo -n $__bobthefish_bg_job_glyph end end end @@ -193,7 +193,7 @@ end function __bobthefish_prompt_user -d 'Display actual user if different from $default_user' if [ "$theme_display_user" = 'yes' ] if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ] - __bobthefish_start_segment $lt_grey $slate_blue + __bobthefish_start_segment $__bobthefish_lt_grey $__bobthefish_slate_blue echo -n -s (whoami) '@' (hostname | cut -d . -f 1) ' ' end end @@ -212,15 +212,15 @@ function __bobthefish_prompt_git -d 'Display the actual git state' set -l flags "$dirty$staged$stashed$ahead$new" test "$flags"; and set flags " $flags" - set -l flag_bg $lt_green - set -l flag_fg $dk_green + set -l flag_bg $__bobthefish_lt_green + set -l flag_fg $__bobthefish_dk_green if test "$dirty" -o "$staged" - set flag_bg $med_red + set flag_bg $__bobthefish_med_red set flag_fg fff else if test "$stashed" - set flag_bg $lt_orange - set flag_fg $dk_orange + set flag_bg $__bobthefish_lt_orange + set flag_fg $__bobthefish_dk_orange end end @@ -236,7 +236,7 @@ function __bobthefish_prompt_git -d 'Display the actual git state' if test -w "$PWD" __bobthefish_start_segment 333 999 else - __bobthefish_start_segment $med_red $lt_red + __bobthefish_start_segment $__bobthefish_med_red $__bobthefish_lt_red end echo -n -s $project_pwd ' '