Add support for choosing to show user and/or hostname in prompt (#71)

Add support for choosing to show user and/or hostname in prompt
pull/112/merge
Ben 6 years ago committed by Justin Hileman
parent 500fc527a7
commit 444b9a4827

@ -77,6 +77,7 @@ set -g theme_display_hg yes
set -g theme_display_virtualenv no
set -g theme_display_ruby no
set -g theme_display_user yes
set -g theme_display_hostname yes
set -g theme_display_vi no
set -g theme_display_date no
set -g theme_display_cmd_duration yes

@ -27,6 +27,7 @@
# set -g theme_display_virtualenv no
# set -g theme_display_ruby no
# set -g theme_display_user yes
# set -g theme_display_hostname yes
# set -g theme_display_vi no
# set -g theme_avoid_ambiguous_glyphs yes
# set -g theme_powerline_fonts no
@ -458,10 +459,23 @@ function __bobthefish_prompt_user -S -d 'Display actual user if different from $
if [ "$theme_display_user" = 'yes' ]
if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ]
__bobthefish_start_segment $__color_username
echo -ns (whoami)
end
end
if [ "$theme_display_hostname" = 'yes' ]
set -l IFS .
hostname | read -l hostname __
echo -ns (whoami) '@' $hostname ' '
end
if [ "$theme_display_user" = 'yes' ]
echo -ns '@' $hostname
else
__bobthefish_start_segment $__color_hostname
echo -ns $hostname
end
end
if [ "$theme_display_user" = 'yes' -o "$theme_display_hostname" = 'yes' ]
echo -ns ' '
end
end
@ -824,6 +838,11 @@ function __bobthefish_maybe_display_colors -S
__bobthefish_finish_segments
echo
__bobthefish_start_segment $__color_hostname
echo -n color_hostname ' '
__bobthefish_finish_segments
echo
__bobthefish_start_segment $__color_rvm
echo -n color_rvm ' '
__bobthefish_finish_segments
@ -966,6 +985,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
#
# set -g __color_vagrant 48b4fb ffffff --bold
# set -g __color_username cccccc 255e87
# set -g __color_hostname cccccc 255e87
# set -g __color_rvm af0000 cccccc --bold
# set -g __color_virtualfish 005faf cccccc --bold
@ -992,6 +1012,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
set __color_vagrant brcyan $colorfg
set __color_username white black
set __color_hostname white black
set __color_rvm brmagenta $colorfg --bold
set __color_virtualfish brblue $colorfg --bold
@ -1018,6 +1039,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
set __color_vagrant brcyan $colorfg
set __color_username black white
set __color_hostname black white
set __color_rvm brmagenta $colorfg --bold
set __color_virtualfish brblue $colorfg --bold
@ -1044,6 +1066,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
set __color_vagrant brcyan $colorfg
set __color_username brgrey white
set __color_hostname brgrey white
set __color_rvm brmagenta $colorfg --bold
set __color_virtualfish brblue $colorfg --bold
@ -1070,6 +1093,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
set __color_vagrant brcyan $colorfg
set __color_username grey black
set __color_hostname grey black
set __color_rvm brmagenta $colorfg --bold
set __color_virtualfish brblue $colorfg --bold
@ -1102,6 +1126,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
set __color_vagrant $blue $green --bold
set __color_username $grey $blue
set __color_hostname $grey $blue
set __color_rvm $red $grey --bold
set __color_virtualfish $blue $grey --bold
@ -1145,6 +1170,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
set __color_vagrant $base0C $colorfg --bold
set __color_username $base02 $base0D
set __color_hostname $base02 $base0D
set __color_rvm $base08 $colorfg --bold
set __color_virtualfish $base0D $colorfg --bold
@ -1188,6 +1214,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
set __color_vagrant $base0C $colorfg --bold
set __color_username $base02 $base0D
set __color_hostname $base02 $base0D
set __color_rvm $base08 $colorfg --bold
set __color_virtualfish $base0D $colorfg --bold
@ -1231,6 +1258,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
set __color_vagrant $violet $colorfg --bold
set __color_username $base2 $blue
set __color_hostname $base2 $blue
set __color_rvm $red $colorfg --bold
set __color_virtualfish $cyan $colorfg --bold
@ -1274,6 +1302,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
set __color_vagrant $violet $colorfg --bold
set __color_username $base02 $blue
set __color_hostname $base02 $blue
set __color_rvm $red $colorfg --bold
set __color_virtualfish $cyan $colorfg --bold
@ -1310,6 +1339,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
set __color_vagrant $blue[1] $white --bold
set __color_username $grey[1] $blue[3]
set __color_hostname $grey[1] $blue[3]
set __color_rvm $ruby_red $grey[1] --bold
set __color_virtualfish $blue[2] $grey[1] --bold
@ -1345,6 +1375,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
set -g __color_vagrant $blue[2] $fg[2] --bold
set -g __color_username $fg[3] $blue[2]
set -g __color_hostname $fg[3] $blue[2]
set -g __color_rvm $red[2] $fg[2] --bold
set -g __color_virtualfish $blue[2] $fg[2] --bold
@ -1381,6 +1412,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
set __color_vagrant $blue[1] $white --bold
set __color_username $grey[1] $blue[3]
set __color_hostname $grey[1] $blue[3]
set __color_rvm $ruby_red $grey[1] --bold
set __color_virtualfish $blue[2] $grey[1] --bold
end

Loading…
Cancel
Save