Skip to content

Commit 9c8f21b

Browse files
author
Meiyo Peng
committed
Add prompt for Guix environment.
1 parent 3b2e847 commit 9c8f21b

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ set -g theme_display_vagrant yes
7979
set -g theme_display_docker_machine no
8080
set -g theme_display_k8s_context yes
8181
set -g theme_display_hg yes
82+
set -g theme_display_guix_environment no
8283
set -g theme_display_virtualenv no
8384
set -g theme_display_ruby no
8485
set -g theme_display_user ssh

fish_prompt.fish

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
# set -g theme_display_docker_machine no
3030
# set -g theme_display_k8s_context yes
3131
# set -g theme_display_hg yes
32+
# set -g theme_display_guix_environment no
3233
# set -g theme_display_virtualenv no
3334
# set -g theme_display_ruby no
3435
# set -g theme_display_user ssh
@@ -655,6 +656,15 @@ end
655656
# Virtual environment segments
656657
# ==============================
657658

659+
function __bobthefish_prompt_guix_environment -S -d 'Display Guix environment'
660+
[ "$theme_display_guix_environment" = 'no' -o -z "$GUIX_ENVIRONMENT" ]
661+
and return
662+
663+
__bobthefish_start_segment $color_guix_environment
664+
echo -ns 'GUIX ENV '
665+
set_color normal
666+
end
667+
658668
function __bobthefish_rvm_parse_ruby -S -a ruby_string -a scope -d 'Parse RVM Ruby string'
659669
# Function arguments:
660670
# - 'ruby-2.2.3@rails', 'jruby-1.7.19'...
@@ -1000,6 +1010,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
10001010
__bobthefish_prompt_user
10011011

10021012
# Virtual environments
1013+
__bobthefish_prompt_guix_environment
10031014
__bobthefish_prompt_desk
10041015
__bobthefish_prompt_rubies
10051016
__bobthefish_prompt_virtualfish

functions/__bobthefish_colors.fish

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
2929
set -x color_k8s magenta white --bold
3030
set -x color_username white black --bold
3131
set -x color_hostname white black
32+
set -x color_guix_environment brblue $colorfg --bold
3233
set -x color_rvm brmagenta $colorfg --bold
3334
set -x color_virtualfish brblue $colorfg --bold
3435
set -x color_virtualgo brblue $colorfg --bold
@@ -59,6 +60,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
5960
set -x color_k8s magenta white --bold
6061
set -x color_username black white --bold
6162
set -x color_hostname black white
63+
set -x color_guix_environment brblue $colorfg --bold
6264
set -x color_rvm brmagenta $colorfg --bold
6365
set -x color_virtualfish brblue $colorfg --bold
6466
set -x color_virtualgo brblue $colorfg --bold
@@ -89,6 +91,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
8991
set -x color_k8s magenta white --bold
9092
set -x color_username brgrey white --bold
9193
set -x color_hostname brgrey white
94+
set -x color_guix_environment brblue $colorfg --bold
9295
set -x color_rvm brmagenta $colorfg --bold
9396
set -x color_virtualfish brblue $colorfg --bold
9497
set -x color_virtualgo brblue $colorfg --bold
@@ -119,6 +122,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
119122
set -x color_k8s magenta white --bold
120123
set -x color_username grey black --bold
121124
set -x color_hostname grey black
125+
set -x color_guix_environment brblue $colorfg --bold
122126
set -x color_rvm brmagenta $colorfg --bold
123127
set -x color_virtualfish brblue $colorfg --bold
124128
set -x color_virtualgo brblue $colorfg --bold
@@ -155,6 +159,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
155159
set -x color_k8s $green $white --bold
156160
set -x color_username $grey $blue --bold
157161
set -x color_hostname $grey $blue
162+
set -x color_guix_environment $blue $grey --bold
158163
set -x color_rvm $red $grey --bold
159164
set -x color_virtualfish $blue $grey --bold
160165
set -x color_virtualgo $blue $grey --bold
@@ -202,6 +207,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
202207
set -x color_k8s $base06 $colorfg --bold
203208
set -x color_username $base02 $base0D --bold
204209
set -x color_hostname $base02 $base0D
210+
set -x color_guix_environment $base0D $colorfg --bold
205211
set -x color_rvm $base08 $colorfg --bold
206212
set -x color_virtualfish $base0D $colorfg --bold
207213
set -x color_virtualgo $base0D $colorfg --bold
@@ -249,6 +255,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
249255
set -x color_k8s $base0B $colorfg --bold
250256
set -x color_username $base02 $base0D --bold
251257
set -x color_hostname $base02 $base0D
258+
set -x color_guix_environment $base0D $colorfg --bold
252259
set -x color_rvm $base08 $colorfg --bold
253260
set -x color_virtualfish $base0D $colorfg --bold
254261
set -x color_virtualgo $base0D $colorfg --bold
@@ -296,6 +303,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
296303
set -x color_k8s $green $colorfg --bold
297304
set -x color_username $base2 $blue --bold
298305
set -x color_hostname $base2 $blue
306+
set -x color_guix_environment $cyan $colorfg --bold
299307
set -x color_rvm $red $colorfg --bold
300308
set -x color_virtualfish $cyan $colorfg --bold
301309
set -x color_virtualgo $cyan $colorfg --bold
@@ -343,6 +351,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
343351
set -x color_k8s $green $colorfg --bold
344352
set -x color_username $base02 $blue --bold
345353
set -x color_hostname $base02 $blue
354+
set -x color_guix_environment $cyan $colorfg --bold
346355
set -x color_rvm $red $colorfg --bold
347356
set -x color_virtualfish $cyan $colorfg --bold
348357
set -x color_virtualgo $cyan $colorfg --bold
@@ -383,6 +392,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
383392
set -x color_k8s $green[1] $colorfg --bold
384393
set -x color_username $grey[1] $blue[3] --bold
385394
set -x color_hostname $grey[1] $blue[3]
395+
set -x color_guix_environment $blue[2] $grey[1] --bold
386396
set -x color_rvm $ruby_red $grey[1] --bold
387397
set -x color_virtualfish $blue[2] $grey[1] --bold
388398
set -x color_virtualgo $blue[2] $grey[1] --bold
@@ -422,6 +432,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
422432
set -x color_k8s $green[2] $fg[2] --bold
423433
set -x color_username $fg[3] $blue[2] --bold
424434
set -x color_hostname $fg[3] $blue[2]
435+
set -x color_guix_environment $blue[2] $fg[2] --bold
425436
set -x color_rvm $red[2] $fg[2] --bold
426437
set -x color_virtualfish $blue[2] $fg[2] --bold
427438
set -x color_virtualgo $blue[2] $fg[2] --bold
@@ -463,6 +474,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
463474
set -x color_k8s $green $fg --bold
464475
set -x color_username $selection $cyan --bold
465476
set -x color_hostname $selection $cyan
477+
set -x color_guix_environment $comment $bg --bold
466478
set -x color_rvm $red $bg --bold
467479
set -x color_virtualfish $comment $bg --bold
468480
set -x color_virtualgo $cyan $bg --bold
@@ -504,6 +516,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe
504516
set -x color_k8s $green[2] $white --bold
505517
set -x color_username $grey[1] $blue[3] --bold
506518
set -x color_hostname $grey[1] $blue[3]
519+
set -x color_guix_environment $blue[2] $grey[1] --bold
507520
set -x color_rvm $ruby_red $grey[1] --bold
508521
set -x color_virtualfish $blue[2] $grey[1] --bold
509522
set -x color_virtualgo $go_blue $black --bold
@@ -529,6 +542,7 @@ function __bobthefish_user_color_scheme_deprecated
529542
set -q __color_vagrant; or set -l __color_vagrant 48b4fb ffffff --bold
530543
set -q __color_username; or set -l __color_username cccccc 255e87 --bold
531544
set -q __color_hostname; or set -l __color_hostname cccccc 255e87
545+
set -q __color_guix_environment; or set -l __color_guix_environment 005faf cccccc --bold
532546
set -q __color_rvm; or set -l __color_rvm af0000 cccccc --bold
533547
set -q __color_virtualfish; or set -l __color_virtualfish 005faf cccccc --bold
534548
set -q __color_virtualgo; or set -l __color_virtualgo 005faf cccccc --bold
@@ -565,6 +579,7 @@ function __bobthefish_user_color_scheme_deprecated
565579
set -x color_vagrant $__color_vagrant
566580
set -x color_username $__color_username
567581
set -x color_hostname $__color_hostname
582+
set -x color_guix_environment $__color_guix_environment
568583
set -x color_rvm $__color_rvm
569584
set -x color_virtualfish $__color_virtualfish
570585
set -x color_virtualgo $__color_virtualgo

functions/bobthefish_display_colors.fish

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ function bobthefish_display_colors -a color_scheme -d 'Print example prompt colo
113113
__bobthefish_finish_segments
114114
echo
115115

116+
__bobthefish_start_segment $color_guix_environment
117+
echo -ns 'GUIX ENVIRONMENT '
118+
__bobthefish_finish_segments
119+
116120
__bobthefish_start_segment $color_rvm
117121
echo -ns $ruby_glyph rvm ' '
118122
__bobthefish_finish_segments

0 commit comments

Comments
 (0)