├── functions ├── __bobthefish_display_colors.fish ├── fish_greeting.fish ├── fish_title.fish ├── fish_mode_prompt.fish ├── fish_right_prompt.fish ├── __bobthefish_glyphs.fish ├── bobthefish_display_colors.fish ├── fish_prompt.fish └── __bobthefish_colors.fish ├── hooks └── install.fish ├── LICENSE └── README.md /functions/__bobthefish_display_colors.fish: -------------------------------------------------------------------------------- 1 | function __bobthefish_display_colors -d 'Print example prompts using the current color scheme' 2 | bobthefish_display_colors 3 | end 4 | -------------------------------------------------------------------------------- /functions/fish_greeting.fish: -------------------------------------------------------------------------------- 1 | function fish_greeting -d "What's up, fish?" 2 | set_color $fish_color_autosuggestion 3 | uname -nmsr 4 | 5 | command -q uptime 6 | and command uptime 7 | 8 | set_color normal 9 | end 10 | -------------------------------------------------------------------------------- /hooks/install.fish: -------------------------------------------------------------------------------- 1 | set -l required_version 2.3.0 2 | 3 | set -l installed_version 1 4 | if set -q FISH_VERSION 5 | set installed_version $FISH_VERSION 6 | else if set -q version 7 | set installed_version $version 8 | end 9 | 10 | set -l latest_version (echo -e "$required_version\\n$installed_version" | command sort -r -n -t '.' -k 1,1 -k 2,2 -k 3,3 -k 4,4 | command head -n 1) 11 | 12 | if [ "$installed_version" != "$latest_version" ] 13 | set_color red 2>/dev/null 14 | echo "Fish $required_version or greater is required for bobthefish." 15 | echo 16 | echo "To use bobthefish with Fish $installed_version, checkout the `support/fish-2.2.x` branch" 17 | echo "in $OMF_PATH/themes/bobthefish/" 18 | set color normal 2>/dev/null 19 | end 20 | -------------------------------------------------------------------------------- /functions/fish_title.fish: -------------------------------------------------------------------------------- 1 | # See "Title options" in README.md for configuration options 2 | 3 | function __bobthefish_title_user -S -d 'Display actual user if different from $default_user' 4 | if [ "$theme_title_display_user" = 'yes' ] 5 | if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ] 6 | set -l IFS . 7 | uname -n | read -l host __ 8 | echo -ns (whoami) '@' $host ' ' 9 | end 10 | end 11 | end 12 | 13 | function fish_title 14 | __bobthefish_title_user 15 | 16 | if [ "$theme_title_display_process" = 'yes' ] 17 | status current-command 18 | 19 | [ "$theme_title_display_path" != 'no' ] 20 | and echo ' ' 21 | end 22 | 23 | if [ "$theme_title_display_path" != 'no' ] 24 | if [ "$theme_title_use_abbreviated_path" = 'no' ] 25 | echo $PWD 26 | else 27 | prompt_pwd 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2021 Justin Hileman 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 19 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 20 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 | OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /functions/fish_mode_prompt.fish: -------------------------------------------------------------------------------- 1 | # Display the current binding mode... if it's vi or vi-like. 2 | # 3 | # To always show the binding mode (regardless of current bindings): 4 | # set -g theme_display_vi yes 5 | # 6 | # To never show: 7 | # set -g theme_display_vi no 8 | 9 | function fish_mode_prompt -d 'bobthefish-optimized fish mode indicator' 10 | [ "$theme_display_vi" != 'no' ] 11 | or return 12 | 13 | [ "$fish_key_bindings" = 'fish_vi_key_bindings' \ 14 | -o "$fish_key_bindings" = 'hybrid_bindings' \ 15 | -o "$fish_key_bindings" = 'fish_hybrid_key_bindings' \ 16 | -o "$theme_display_vi" = 'yes' ] 17 | or return 18 | 19 | __bobthefish_colors $theme_color_scheme 20 | 21 | type -q bobthefish_colors 22 | and bobthefish_colors 23 | 24 | set_color normal # clear out anything bold or underline... 25 | 26 | switch $fish_bind_mode 27 | case default 28 | set_color -b $color_vi_mode_default 29 | echo -n ' N ' 30 | case insert 31 | set_color -b $color_vi_mode_insert 32 | echo -n ' I ' 33 | case replace replace_one replace-one 34 | set_color -b $color_vi_mode_insert 35 | echo -n ' R ' 36 | case visual 37 | set_color -b $color_vi_mode_visual 38 | echo -n ' V ' 39 | end 40 | 41 | set_color normal 42 | end 43 | -------------------------------------------------------------------------------- /functions/fish_right_prompt.fish: -------------------------------------------------------------------------------- 1 | # See "Right prompt options" in README.md for configuration options 2 | 3 | function __bobthefish_cmd_duration -S -d 'Show command duration' 4 | [ "$theme_display_cmd_duration" = "no" ] 5 | and return 6 | 7 | [ -z "$CMD_DURATION" -o "$CMD_DURATION" -lt 100 ] 8 | and return 9 | 10 | if [ "$CMD_DURATION" -lt 5000 ] 11 | echo -ns $CMD_DURATION 'ms' 12 | else if [ "$CMD_DURATION" -lt 60000 ] 13 | __bobthefish_pretty_ms $CMD_DURATION s 14 | else if [ "$CMD_DURATION" -lt 3600000 ] 15 | set_color $fish_color_error 16 | __bobthefish_pretty_ms $CMD_DURATION m 17 | else 18 | set_color $fish_color_error 19 | __bobthefish_pretty_ms $CMD_DURATION h 20 | end 21 | 22 | set_color $fish_color_normal 23 | set_color $fish_color_autosuggestion 24 | 25 | [ "$theme_display_date" = "no" ] 26 | or echo -ns ' ' $__bobthefish_left_arrow_glyph 27 | end 28 | 29 | function __bobthefish_pretty_ms -S -a ms -a interval -d 'Millisecond formatting for humans' 30 | set -l interval_ms 31 | set -l scale 1 32 | 33 | switch $interval 34 | case s 35 | set interval_ms 1000 36 | case m 37 | set interval_ms 60000 38 | case h 39 | set interval_ms 3600000 40 | set scale 2 41 | end 42 | 43 | switch $FISH_VERSION 44 | case 2.0.\* 2.1.\* 2.2.\* 2.3.\* 45 | # Fish 2.3 and lower doesn't know about the -s argument to math. 46 | math "scale=$scale;$ms/$interval_ms" | string replace -r '\\.?0*$' $interval 47 | case 2.\* 48 | # Fish 2.x always returned a float when given the -s argument. 49 | math -s$scale "$ms/$interval_ms" | string replace -r '\\.?0*$' $interval 50 | case \* 51 | math -s$scale "$ms/$interval_ms" 52 | echo -ns $interval 53 | end 54 | end 55 | 56 | function __bobthefish_timestamp -S -d 'Show the current timestamp' 57 | [ "$theme_display_date" = "no" ] 58 | and return 59 | 60 | set -q theme_date_format 61 | or set -l theme_date_format "+%c" 62 | 63 | echo -n ' ' 64 | set -q theme_date_timezone 65 | and env TZ="$theme_date_timezone" date $theme_date_format 66 | or date $theme_date_format 67 | end 68 | 69 | function fish_right_prompt -d 'bobthefish is all about the right prompt' 70 | set -l __bobthefish_left_arrow_glyph \uE0B3 71 | if [ "$theme_powerline_fonts" = "no" -a "$theme_nerd_fonts" != "yes" ] 72 | set __bobthefish_left_arrow_glyph '<' 73 | end 74 | 75 | set_color $fish_color_autosuggestion 76 | 77 | __bobthefish_cmd_duration 78 | __bobthefish_timestamp 79 | set_color normal 80 | end 81 | -------------------------------------------------------------------------------- /functions/__bobthefish_glyphs.fish: -------------------------------------------------------------------------------- 1 | function __bobthefish_glyphs -S -d 'Define glyphs used by bobthefish' 2 | # Powerline glyphs 3 | set -x branch_glyph \uE0A0 4 | set -x right_black_arrow_glyph \uE0B0 5 | set -x right_arrow_glyph \uE0B1 6 | set -x left_black_arrow_glyph \uE0B2 7 | set -x left_arrow_glyph \uE0B3 8 | 9 | # Additional glyphs 10 | set -x detached_glyph \u27A6 11 | set -x tag_glyph \u2302 12 | set -x nonzero_exit_glyph '! ' 13 | set -x private_glyph \uE0A2 ' ' 14 | set -x superuser_glyph '$ ' 15 | set -x bg_job_glyph '% ' 16 | set -x hg_glyph \u263F 17 | 18 | # Python glyphs 19 | set -x superscript_glyph \u00B9 \u00B2 \u00B3 20 | set -x virtualenv_glyph \u25F0 21 | set -x pypy_glyph \u1D56 22 | 23 | set -x ruby_glyph '' 24 | set -x go_glyph '' 25 | set -x nix_glyph '' 26 | 27 | # Desk glyphs 28 | set -x desk_glyph \u25F2 29 | 30 | # Kubernetes glyphs 31 | set -x k8s_glyph \u2388 # '⎈' 32 | 33 | # Vagrant glyphs 34 | set -x vagrant_running_glyph \u2191 # ↑ 'running' 35 | set -x vagrant_poweroff_glyph \u2193 # ↓ 'poweroff' 36 | set -x vagrant_aborted_glyph \u2715 # ✕ 'aborted' 37 | set -x vagrant_saved_glyph \u21E1 # ⇡ 'saved' 38 | set -x vagrant_stopping_glyph \u21E3 # ⇣ 'stopping' 39 | set -x vagrant_unknown_glyph '!' # strange cases 40 | 41 | # Git glyphs 42 | set -x git_dirty_glyph '*' 43 | set -x git_staged_glyph '~' 44 | set -x git_stashed_glyph '$' 45 | set -x git_untracked_glyph '…' 46 | set -x git_ahead_glyph \u2191 # '↑' 47 | set -x git_behind_glyph \u2193 # '↓' 48 | set -x git_plus_glyph '+' 49 | set -x git_minus_glyph '-' 50 | set -x git_plus_minus_glyph '±' 51 | 52 | # Fossil glyph (it reuses most of the git glyphs) 53 | set -x fossil_glyph \U1F9B4 # Unicode bone emoji 54 | 55 | # Disable Powerline fonts (unless we're using nerd fonts instead) 56 | if [ "$theme_powerline_fonts" = "no" -a "$theme_nerd_fonts" != "yes" ] 57 | set private_glyph \u29B8 ' ' 58 | set branch_glyph \u2387 59 | set right_black_arrow_glyph '' 60 | set right_arrow_glyph '' 61 | set left_black_arrow_glyph '' 62 | set left_arrow_glyph '' 63 | end 64 | 65 | # Use prettier Nerd Fonts glyphs 66 | if [ "$theme_nerd_fonts" = "yes" ] 67 | set private_glyph \uF023 ' ' # nf-fa-lock 68 | 69 | set branch_glyph \uF418 70 | set detached_glyph \uF417 71 | set tag_glyph \uF412 72 | 73 | set nix_glyph \uF313 ' ' # nf-linux-nixos 74 | set virtualenv_glyph \uE73C ' ' 75 | set ruby_glyph \uE791 ' ' 76 | set go_glyph \uE626 ' ' 77 | set node_glyph \uE718 ' ' 78 | 79 | set vagrant_running_glyph \uF431 # ↑ 'running' 80 | set vagrant_poweroff_glyph \uF433 # ↓ 'poweroff' 81 | set vagrant_aborted_glyph \uF468 # ✕ 'aborted' 82 | set vagrant_unknown_glyph \uF421 # strange cases 83 | 84 | set git_dirty_glyph \uF448 '' # nf-oct-pencil 85 | set git_staged_glyph \uF0C7 '' # nf-fa-save 86 | set git_stashed_glyph \uF0C6 '' # nf-fa-paperclip 87 | set git_untracked_glyph \uF128 '' # nf-fa-question 88 | # set git_untracked_glyph \uF141 '' # nf-fa-ellipsis_h 89 | set fossil_glyph \UF00B9 # nf-md-bone 90 | 91 | set git_ahead_glyph \uF47B # nf-oct-chevron_up 92 | set git_behind_glyph \uF47C # nf-oct-chevron_down 93 | 94 | set git_plus_glyph \uF0DE # fa-sort-asc 95 | set git_minus_glyph \uF0DD # fa-sort-desc 96 | set git_plus_minus_glyph \uF0DC # fa-sort 97 | end 98 | 99 | # Avoid ambiguous glyphs 100 | if [ "$theme_avoid_ambiguous_glyphs" = "yes" ] 101 | set git_untracked_glyph '...' 102 | set fossil_glyph '' # blank, for lack of a good fallback 103 | end 104 | end 105 | -------------------------------------------------------------------------------- /functions/bobthefish_display_colors.fish: -------------------------------------------------------------------------------- 1 | function bobthefish_display_colors -a color_scheme -d 'Print example prompt color schemes' 2 | 3 | set -l color_schemes default light \ 4 | solarized solarized-light \ 5 | base16 base16-light \ 6 | gruvbox gruvbox-light zenburn \ 7 | dracula nord \ 8 | catppuccin-latte catppuccin-frappe \ 9 | catppuccin-macchiato catppuccin-mocha \ 10 | jellybeans \ 11 | terminal terminal-dark-white \ 12 | terminal-light terminal-light-black \ 13 | terminal2 terminal2-dark-white \ 14 | terminal2-light terminal2-light-black 15 | 16 | switch "$color_scheme" 17 | case '--all' 18 | for scheme in $color_schemes 19 | echo 20 | echo "$scheme:" 21 | bobthefish_display_colors $scheme 22 | end 23 | return 24 | 25 | case $color_schemes 26 | __bobthefish_colors $color_scheme 27 | 28 | case '' 29 | if type -q bobthefish_colors 30 | if [ -n "$theme_color_scheme" ] 31 | echo "$theme_color_scheme (with bobthefish_colors overrides):" 32 | else 33 | echo 'custom (via bobthefish_colors):' 34 | end 35 | else if [ -n "$theme_color_scheme" ] 36 | echo "$theme_color_scheme:" 37 | end 38 | 39 | __bobthefish_colors $theme_color_scheme 40 | type -q bobthefish_colors 41 | and bobthefish_colors 42 | 43 | case '*' 44 | echo 'usage: bobthefish_display_colors [--all] [color_scheme]' 45 | return 46 | end 47 | 48 | __bobthefish_glyphs 49 | 50 | echo 51 | set_color normal 52 | 53 | __bobthefish_start_segment $color_initial_segment_exit 54 | echo -n exit $nonzero_exit_glyph 55 | set_color -b $color_initial_segment_private 56 | echo -n private $private_glyph 57 | set_color -b $color_initial_segment_su 58 | echo -n su $superuser_glyph 59 | set_color -b $color_initial_segment_jobs 60 | echo -n jobs $bg_job_glyph 61 | __bobthefish_finish_segments 62 | set_color normal 63 | echo -n "(<- initial_segment)" 64 | echo 65 | 66 | __bobthefish_start_segment $color_path 67 | echo -n /color/path/ 68 | set_color -b $color_path_basename 69 | echo -ns basename ' ' 70 | __bobthefish_finish_segments 71 | echo 72 | 73 | __bobthefish_start_segment $color_path_nowrite 74 | echo -n /color/path/nowrite/ 75 | set_color -b $color_path_nowrite_basename 76 | echo -ns basename ' ' 77 | __bobthefish_finish_segments 78 | echo 79 | 80 | __bobthefish_start_segment $color_path 81 | echo -n /color/path/ 82 | set_color -b $color_path_basename 83 | echo -ns basename ' ' 84 | __bobthefish_start_segment $color_repo 85 | echo -n "$branch_glyph repo $git_stashed_glyph " 86 | __bobthefish_finish_segments 87 | echo 88 | 89 | __bobthefish_start_segment $color_path 90 | echo -n /color/path/ 91 | set_color -b $color_path_basename 92 | echo -ns basename ' ' 93 | __bobthefish_start_segment $color_repo_dirty 94 | echo -n "$tag_glyph repo_dirty $git_dirty_glyph " 95 | __bobthefish_finish_segments 96 | echo 97 | 98 | __bobthefish_start_segment $color_path 99 | echo -n /color/path/ 100 | set_color -b $color_path_basename 101 | echo -ns basename ' ' 102 | __bobthefish_start_segment $color_repo_staged 103 | echo -n "$detached_glyph repo_staged $git_staged_glyph " 104 | __bobthefish_finish_segments 105 | echo 106 | 107 | __bobthefish_start_segment $color_vi_mode_default 108 | echo -ns vi_mode_default ' ' 109 | __bobthefish_finish_segments 110 | __bobthefish_start_segment $color_vi_mode_insert 111 | echo -ns vi_mode_insert ' ' 112 | __bobthefish_finish_segments 113 | __bobthefish_start_segment $color_vi_mode_visual 114 | echo -ns vi_mode_visual ' ' 115 | __bobthefish_finish_segments 116 | echo 117 | 118 | __bobthefish_start_segment $color_vagrant 119 | echo -ns $vagrant_running_glyph ' ' vagrant ' ' 120 | __bobthefish_finish_segments 121 | echo 122 | 123 | __bobthefish_start_segment $color_username 124 | echo -n username 125 | set_color normal 126 | set_color -b $color_hostname[1] $color_hostname[2..-1] 127 | echo -ns @hostname ' ' 128 | __bobthefish_finish_segments 129 | echo 130 | 131 | __bobthefish_start_segment $color_screen 132 | echo -ns 'screen ' 133 | __bobthefish_finish_segments 134 | echo 135 | 136 | __bobthefish_start_segment $color_rvm 137 | echo -ns $ruby_glyph rvm ' ' 138 | __bobthefish_finish_segments 139 | 140 | __bobthefish_start_segment $color_nvm 141 | echo -ns $ruby_glyph nvm ' ' 142 | __bobthefish_finish_segments 143 | 144 | __bobthefish_start_segment $color_virtualfish 145 | echo -ns $virtualenv_glyph virtualfish ' ' 146 | __bobthefish_finish_segments 147 | 148 | __bobthefish_start_segment $color_virtualgo 149 | echo -ns $go_glyph virtualgo ' ' 150 | __bobthefish_finish_segments 151 | 152 | __bobthefish_start_segment $color_desk 153 | echo -ns $desk_glyph desk ' ' 154 | __bobthefish_finish_segments 155 | echo 156 | 157 | __bobthefish_start_segment $color_aws_vault 158 | echo -ns aws-vault ' (' active ') ' 159 | __bobthefish_finish_segments 160 | 161 | __bobthefish_start_segment $color_aws_vault_expired 162 | echo -ns aws-vault ' (' expired ') ' 163 | __bobthefish_finish_segments 164 | 165 | __bobthefish_start_segment $color_k8s 166 | echo -ns $k8s_glyph ' k8s-context' 167 | __bobthefish_finish_segments 168 | 169 | echo -e "\n" 170 | end 171 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # bobthefish 2 | 3 | `bobthefish` is a Powerline-style, Git-aware [fish][btf-fish] theme optimized for awesome. 4 | 5 | [![Oh My Fish](https://img.shields.io/badge/Framework-Oh_My_Fish-blue.svg?style=flat)](https://github.com/oh-my-fish/oh-my-fish) [![MIT License](https://img.shields.io/github/license/oh-my-fish/theme-bobthefish.svg?style=flat)](/LICENSE.md) 6 | 7 | ![bobthefish][btf-screencast] 8 | 9 | 10 | 11 | ## Installation 12 | 13 | Be sure to have Oh My Fish installed. Then just: 14 | 15 | omf install bobthefish 16 | 17 | You will need a [Powerline-patched font][btf-patching] for this to work, unless you enable the compatibility fallback option: 18 | 19 | set -g theme_powerline_fonts no 20 | 21 | [I recommend picking one of these][btf-fonts]. For more advanced awesome, install a [nerd fonts patched font][btf-nerd-fonts], and enable nerd fonts support: 22 | 23 | set -g theme_nerd_fonts yes 24 | 25 | This theme is based loosely on [agnoster][btf-agnoster]. 26 | 27 | 28 | 29 | ## Features 30 | 31 | * A helpful, but not too distracting, greeting. 32 | * A subtle timestamp hanging out off to the right. 33 | * Powerline-style visual hotness. 34 | * More colors than you know what to do with. 35 | * An abbreviated path which doesn't abbreviate the name of the current project. 36 | * All the things you need to know about Git in a glance. 37 | * Visual indication that you can't write to the current directory. 38 | 39 | 40 | 41 | ## The Prompt 42 | 43 | * Status flags: 44 | * Previous command failed (**`!`**) 45 | * Private mode (**🔒** or **`⦸`**) 46 | * You currently have superpowers (**`$`**) 47 | * Background jobs (**`%`**) 48 | * Current vi mode 49 | * `User@Host` (unless you're the default user) 50 | * Current RVM, rbenv or chruby (Ruby) version 51 | * Current virtualenv (Python) version 52 | * _If you use virtualenv, you will probably need to disable the default virtualenv prompt, since it doesn't play nice with fish: `set -x VIRTUAL_ENV_DISABLE_PROMPT 1`_ 53 | * Current NVM/FNM version (Nodejs) (inactive by default; see configurations in the next paragraph) 54 | * Abbreviated parent directory 55 | * Current directory, or Git or Mercurial project name 56 | * Current project's repo branch (branch-glyph master) or detached head (`➦` d0dfd9b) 57 | * Git or Mercurial status, via colors and flags: 58 | * Dirty working directory (**`*`**) 59 | * Untracked files (**`…`**) 60 | * Staged changes (**`~`**) 61 | * Stashed changes (**`$`**) 62 | * Unpulled commits (**`-`**) 63 | * Unpushed commits (**`+`**) 64 | * Unpulled _and_ unpushed commits (**`±`**) 65 | * _Note that not all of these have been implemented for hg yet :)_ 66 | * Fossil status: 67 | * Dirty working directory (**`*`**) 68 | * Untracked files (**`…`**) 69 | * Conflicts (**`!`**) 70 | * Abbreviated project-relative path 71 | 72 | 73 | 74 | ## Configuration 75 | 76 | You can override theme defaults in a Fish config file (for example `~/.config/fish/conf.d/bobthefish.fish`): 77 | 78 | ```fish 79 | set -g theme_nerd_fonts yes 80 | set -g theme_color_scheme dark 81 | set -g theme_display_user ssh 82 | set -g default_user bobthecow 83 | ``` 84 | 85 | See (many) more options below. 86 | 87 | 88 | 89 | ### Prompt options 90 | 91 | #### `set -g theme_display_vi yes` 92 | 93 | By default the vi mode indicator will be shown if vi or hybrid key bindings are enabled. Use `no` to always hide the indicator, or `yes` to always show the indicator. 94 | 95 | #### `set -g theme_show_exit_status yes` 96 | 97 | Use `yes` to show any non-zero exit code next to the exclamation mark. 98 | 99 | #### `set -g theme_display_jobs_verbose yes` 100 | 101 | Use `yes` to display the number of currently running background jobs next to the percent sign. 102 | 103 | #### `set -g theme_display_user yes` 104 | 105 | Set to `yes` to always display the username, to `ssh` to display only when an SSH session is active, or to `no` to never display the username. 106 | 107 | #### `set -g default_user your_normal_user` 108 | 109 | If a `default_user` is provided, the username will only be shown when it differs from the default. 110 | 111 | #### `set -g theme_display_sudo_user yes` 112 | 113 | If set to `yes`, displays the sudoer's username in a root shell. For example, when calling `sudo -s` with this option set to `yes`, the user who called `sudo -s` will be displayed. 114 | 115 | #### `set -g theme_display_hostname yes` 116 | 117 | Set to `yes` to always display the hostname, to `ssh` to display only when an SSH session is active, or to `no` to never display the hostname. 118 | 119 | #### `set -g fish_prompt_pwd_dir_length 1` 120 | 121 | Bobthefish respects the Fish `$fish_prompt_pwd_dir_length` setting to abbreviate the prompt path; set to `0` to show the full path, `1` (default) to show only the first character of each parent directory name, or any other number to show up to that many characters. 122 | 123 | #### `set -g theme_project_dir_length 1` 124 | 125 | The same as `$fish_prompt_pwd_dir_length`, but for the path relative to the current project root. Defaults to `0`; set to any other number to show an abbreviated path. 126 | 127 | #### `set -g theme_show_project_parent no` 128 | 129 | Use `no` to only show the project directory name, and not its parent path, when inside a project. 130 | 131 | #### `set -g theme_newline_cursor yes` 132 | 133 | Use `yes` to place the cursor on the next line, rather than the same line as the prompt. Setting this to `clean` instead of `yes` suppresses the caret on the new line. 134 | 135 | #### `set -g theme_newline_prompt "\$"` 136 | 137 | Use a custom prompt with newline cursor. By default this is the chevron right glyph or `>` when powerline fonts are disabled. 138 | 139 | #### `set -g theme_avoid_ambiguous_glyphs yes` 140 | 141 | You probably don't need this option, unless your terminal doesn't like Unicode. Setting to `yes` will avoid ambiguous-width characters in an attempt to 142 | 143 | #### `set -g theme_powerline_fonts no` 144 | 145 | Bobthefish really likes Powerline-enhanced fonts. If you can't make that work, set to `no` to use plaintext fallbacks. 146 | 147 | #### `set -g theme_nerd_fonts yes` 148 | 149 | Bobthefish likes Nerd Fonts even better! Use `yes` if you've got Nerd Font capable fonts. 150 | 151 | #### `set -g theme_color_scheme dark` 152 | 153 | See below for all the color scheming you can handle. 154 | 155 | 156 | 157 | ### Virtual environments and version manager options 158 | 159 | #### `set -g theme_display_screen no` 160 | 161 | Use `no` to disable screen session information. 162 | 163 | #### `set -g theme_display_vagrant yes` 164 | 165 | This feature is disabled by default, use `yes` to display Vagrant status in your prompt. Please note that only the VirtualBox and VMWare providers are supported. 166 | 167 | #### `set -g theme_display_docker_machine no` 168 | 169 | Use `no` to disable the current Docker machine name. 170 | 171 | #### `set -g theme_display_ruby no` 172 | 173 | Use `no` to disable Ruby version information. By default, the Ruby version is displayed unless it's your system Ruby version. 174 | 175 | #### `set -g theme_display_virtualenv no` 176 | 177 | Use `no` to disable Python version information. By default, the Python version is shown when it's interesting, along with the Virtualenv or Conda environmenmt. 178 | 179 | #### `set -g theme_display_go verbose` 180 | 181 | Use `no` to disable the Go version information. Set to `verbose` to show both the required and current Go version. 182 | 183 | #### `set -g theme_display_node yes` 184 | 185 | This feature is disabled by default. Use `yes`, display the version if an `.nvmrc`, `.node-version` or `package.json` file is found in the parent path. Set to `always` to always display the current NPM, NVM or FNM node version. 186 | 187 | #### `set -g theme_display_nix no` 188 | 189 | Use `no` to disable Nix environment information. 190 | 191 | #### `set -g theme_display_k8s_context yes` 192 | 193 | This feature is disabled by default. Use `yes` to show the current Kubernetes context (`> kubectl config current-context`). 194 | 195 | #### `set -g theme_display_k8s_namespace yes` 196 | 197 | This feature is disabled by default. Use `yes` to show the current Kubernetes namespace. 198 | 199 | #### `set -g theme_display_aws_vault_profile yes` 200 | 201 | This feature is disabled by default. Use `yes` to show the currently executing [AWS Vault](https://github.com/99designs/aws-vault) profile. 202 | 203 | 204 | 205 | ### Git (and other VCS) options 206 | 207 | #### `set -g theme_display_git no` 208 | 209 | Use `no` to disable Git integration. If you're doing this for performance reasons, try some of the options below before disabling it entirely! 210 | 211 | #### `set -g theme_display_git_dirty no` 212 | 213 | Use `no` to hide Git dirty state. Set the Git `bash.showDirtyState` option on a per-repository basis to disable it just for especially large repos. 214 | 215 | #### `set -g theme_display_git_dirty_verbose yes` 216 | 217 | This feature is disabled by default. Use `yes` to show more verbose dirty state information. 218 | 219 | #### `set -g theme_display_git_untracked no` 220 | 221 | Use `no` to hide Git untracked file state. Set the Git `bash.showUntrackedFiles` option on a per-repository basis to disable it just for especially large repos. 222 | 223 | #### `set -g theme_display_git_ahead_verbose yes` 224 | 225 | This feature is disabled by default. Use `yes` to show more verbose ahead/behind state information. 226 | 227 | #### `set -g theme_display_git_stashed_verbose yes` 228 | 229 | This feature is disabled by default. Use `yes` to show more verbose stashed state information. 230 | 231 | #### `set -g theme_display_git_default_branch yes` 232 | 233 | By default, Bobthefish hides the default branch name (e.g. `main` or `master`). Use `yes` to always show these branche names. 234 | 235 | #### `set -g theme_git_default_branches main trunk` 236 | 237 | By default, Bobthefish hides default branch names (e.g. `main` or `master`). To hide other branch names, you can set a custom default branch name via the `init.defaultBranch` Git config option, or override the list entirely. 238 | 239 | #### `set -g theme_use_abbreviated_branch_name yes` 240 | 241 | This feature is disabled by default. Use `yes` to truncate extremely long Git branch names. 242 | 243 | #### `set -g theme_git_worktree_support yes` 244 | 245 | If you do any Git worktree shenanigans, setting this to `yes` will fix incorrect project-relative paths. If you don't do any Git worktree shenanigans, leave it disabled. It's faster this way :) 246 | 247 | #### `set -g theme_display_hg yes` 248 | 249 | This feature is disabled by default. Use `yes` to enable Mercurial support in Bobthefish. If you don't use Mercurial, leave it disabled because it's ... not fast. 250 | 251 | #### `set -g theme_display_fossil yes` 252 | 253 | This feature is also disabled by default. It should be faster than Mercurial, but if you aren't using Fossil it's safe to leave disabled. 254 | 255 | #### `set -g theme_vcs_ignore_paths /some/path /some/other/path{foo,bar}` 256 | 257 | Ignore project paths for Git or Mercurial. Supports glob patterns. 258 | 259 | 260 | 261 | ### Right prompt options 262 | 263 | The right prompt can be configured with the following options, or overridden entirely by supplying your own `fish_right_prompt` function. 264 | 265 | #### `set -g theme_display_date` 266 | 267 | Use `no` to disable the date in the right prompt. 268 | 269 | #### `set -g theme_date_format +%c` 270 | 271 | Customize date formatting. See `man date` for more information. 272 | 273 | #### `set -g theme_date_timezone America/Los_Angeles` 274 | 275 | Supply a TZ argument variable for date formatting. See `man date` for more information. 276 | 277 | #### `set -g theme_display_cmd_duration no` 278 | 279 | Use `no` to disable command duration in the right prompt. 280 | 281 | 282 | 283 | ### Title options 284 | 285 | #### `set -g theme_title_display_process yes` 286 | 287 | This feature is disabled by default. Use `yes` to show current process name in the terminal title. 288 | 289 | #### `set -g theme_title_display_path no` 290 | 291 | Use `no` to hide current working directory from the terminal title. 292 | 293 | #### `set -g theme_title_display_user yes` 294 | 295 | Use `yes` to show the current user in the tab title (unless you're the default user). 296 | 297 | #### `set -g theme_title_use_abbreviated_path no` 298 | 299 | By default, directory names will be abbreviated in the terminal title, for example `~` instead of `$HOME` and `/u/local` instead of `/usr/local`. Set to `no` to always show full paths in the title. 300 | 301 | 302 | 303 | ### Color schemes 304 | 305 | | ![dark][btf-dark] | ![light][btf-light] | 306 | | --------------------------- | --------------------------------------- | 307 | | ![solarized][btf-solarized] | ![solarized-light][btf-solarized-light] | 308 | | ![base16][btf-base16] | ![base16-light][btf-base16-light] | 309 | | ![zenburn][btf-zenburn] | ![terminal-dark][btf-terminal-dark] | 310 | | ![nord][btf-nord] | ![gruvbox-light][gruvbox-light] | 311 | 312 | You can use the function `bobthefish_display_colors` to preview the prompts in 313 | any color scheme. 314 | 315 | Set `theme_color_scheme` in a terminal session or in your fish startup files to 316 | one of the following options to change the prompt colors. 317 | 318 | - `dark`. The default bobthefish theme. 319 | - `light`. A lighter version of the default theme. 320 | - `solarized` (or `solarized-dark`), `solarized-light`. Dark and light variants 321 | of Solarized. 322 | - `base16` (or `base16-dark`), `base16-light`. Dark and light variants of the 323 | default Base16 theme. 324 | - `zenburn`. An adaptation of Zenburn. 325 | - `gruvbox`, `gruvbox-light`. An adaptation of gruvbox dark and light variants. 326 | - `dracula`. An adaptation of dracula. 327 | - `nord`. An adaptation of nord. 328 | - `catpuccin-latte`, `catpuccin-frappe`, `catpuccin-macchiato`, `catpuccin-mocha`. Adaptations of the Cattpuccin themes. 329 | 330 | Some of these may not look right if your terminal does not support 24 bit color, 331 | in which case you can try one of the `terminal` schemes (below). However, if 332 | you're using Solarized, Base16 (default), or Zenburn in your terminal and the 333 | terminal *does* support 24 bit color, the built in schemes will look nicer. 334 | 335 | There are several scheme that use whichever colors you currently have loaded 336 | into your terminal. The advantage of using the schemes that fall through to the 337 | terminal colors is that they automatically adapt to something acceptable 338 | whenever you change the 16 colors in your terminal profile. 339 | - `terminal` (or `terminal-dark` or `terminal-dark-black`) 340 | - `terminal-dark-white`. Same as `terminal`, but use white as the foreground 341 | color on top of colored segments (in case your colors are very dark). 342 | - `terminal-light` (or `terminal-light-white`) 343 | - `terminal-light-black`. Same as `terminal-light`, but use black as the 344 | foreground color on top of colored segments (in case your colors are very 345 | bright). 346 | 347 | For some terminal themes, like dark base16 themes, the path segments in the 348 | prompt will be indistinguishable from the background. In those cases, try one of 349 | the following variations; they are identical to the `terminal` schemes except 350 | for using bright black (`brgrey`) and dull white (`grey`) in the place of black 351 | and bright white. 352 | - `terminal2` (or `terminal2-dark` or `terminal2-dark-black`) 353 | - `terminal2-dark-white` 354 | - `terminal2-light` (or `terminal2-light-white`) 355 | - `terminal2-light-black` 356 | 357 | ### Custom Color Schemes 358 | 359 | To override the colors provided by a theme, set up a `bobthefish_colors` function in your configuration (`config.fish` or otherwise): 360 | ```fish 361 | function bobthefish_colors -S -d 'Define a custom bobthefish color scheme' 362 | 363 | # optionally include a base color scheme... 364 | ___bobthefish_colors default 365 | 366 | # then override everything you want! note that these must be defined with `set -x` 367 | set -x color_initial_segment_exit ffffff ce000f --bold 368 | set -x color_initial_segment_private ffffff 255e87 369 | set -x color_initial_segment_su ffffff 189303 --bold 370 | set -x color_initial_segment_jobs ffffff 255e87 --bold 371 | set -x color_path 333333 999999 372 | set -x color_path_basename 333333 ffffff --bold 373 | set -x color_path_nowrite 660000 cc9999 374 | set -x color_path_nowrite_basename 660000 cc9999 --bold 375 | set -x color_repo addc10 0c4801 376 | set -x color_repo_work_tree 333333 ffffff --bold 377 | set -x color_repo_dirty ce000f ffffff 378 | set -x color_repo_staged f6b117 3a2a03 379 | set -x color_vi_mode_default 999999 333333 --bold 380 | set -x color_vi_mode_insert 189303 333333 --bold 381 | set -x color_vi_mode_visual f6b117 3a2a03 --bold 382 | set -x color_vagrant 48b4fb ffffff --bold 383 | set -x color_aws_vault 384 | set -x color_aws_vault_expired 385 | set -x color_username cccccc 255e87 --bold 386 | set -x color_hostname cccccc 255e87 387 | set -x color_rvm af0000 cccccc --bold 388 | set -x color_virtualfish 005faf cccccc --bold 389 | set -x color_virtualgo 005faf cccccc --bold 390 | set -x color_desk 005faf cccccc --bold 391 | set -x color_nix 005faf cccccc --bold 392 | end 393 | ``` 394 | 395 | ## Overrides 396 | 397 | You can disable the theme default greeting, vi mode prompt, right prompt, or title entirely — or override with your own — by adding custom functions to `~/.config/fish/functions`: 398 | 399 | - `~/.config/fish/functions/fish_greeting.fish` 400 | - `~/.config/fish/functions/fish_mode_prompt.fish` 401 | - `~/.config/fish/functions/fish_right_prompt.fish` 402 | - `~/.config/fish/functions/fish_title.fish` 403 | 404 | To disable them completely, use an empty function: 405 | 406 | ```fish 407 | function fish_right_prompt; end 408 | ``` 409 | 410 | … Or copy one from your favorite theme, make up something of your own, or copy/paste a bobthefish default function and modify it to your taste! 411 | 412 | ```fish 413 | function fish_greeting 414 | set_color $fish_color_autosuggestion 415 | echo "I'm completely operational, and all my circuits are functioning perfectly." 416 | set_color normal 417 | end 418 | ``` 419 | 420 | 421 | [btf-fish]: https://github.com/fish-shell/fish-shell 422 | [btf-screencast]: https://cloud.githubusercontent.com/assets/53660/18028510/f16f6b2c-6c35-11e6-8eb9-9f23ea3cce2e.gif 423 | [btf-patching]: https://powerline.readthedocs.org/en/master/installation.html#patched-fonts 424 | [btf-fonts]: https://github.com/Lokaltog/powerline-fonts 425 | [btf-nerd-fonts]: https://github.com/ryanoasis/nerd-fonts 426 | [btf-agnoster]: https://gist.github.com/agnoster/3712874 427 | 428 | [btf-dark]: https://cloud.githubusercontent.com/assets/53660/16141569/ee2bbe4a-3411-11e6-85dc-3d9b0226e833.png "dark" 429 | [btf-light]: https://cloud.githubusercontent.com/assets/53660/16141570/f106afc6-3411-11e6-877d-fc2a8f6d3175.png "light" 430 | [btf-solarized]: https://cloud.githubusercontent.com/assets/53660/16141572/f7724032-3411-11e6-8771-b43769e7afec.png "solarized" 431 | [btf-solarized-light]: https://cloud.githubusercontent.com/assets/53660/16141575/fbed8036-3411-11e6-92e9-90da6d45f94b.png "solarized-light" 432 | [btf-base16]: https://cloud.githubusercontent.com/assets/53660/16141577/0134763a-3412-11e6-9cca-6040d39c8fd4.png "base16" 433 | [btf-base16-light]: https://cloud.githubusercontent.com/assets/53660/16141579/02f7245e-3412-11e6-97c6-5f3cecffb73c.png "base16-light" 434 | [btf-zenburn]: https://cloud.githubusercontent.com/assets/53660/16141580/06229dd4-3412-11e6-84aa-a48de127b6da.png "zenburn" 435 | [btf-terminal-dark]: https://cloud.githubusercontent.com/assets/53660/16141583/0b3e8eea-3412-11e6-8068-617c5371f6ea.png "terminal-dark" 436 | [btf-nord]: https://user-images.githubusercontent.com/39213657/72811435-f64ca800-3c5f-11ea-8711-dcce8cfc50fb.png "nord" 437 | [gruvbox-light]: https://user-images.githubusercontent.com/458535/97345492-6a207e80-188a-11eb-92df-30f33419238b.png "gruvbox-light" 438 | -------------------------------------------------------------------------------- /functions/fish_prompt.fish: -------------------------------------------------------------------------------- 1 | # name: bobthefish 2 | # 3 | # bobthefish is a Powerline-style, Git-aware fish theme optimized for awesome. 4 | # 5 | # You will need a Powerline-patched font for this to work: 6 | # 7 | # https://powerline.readthedocs.org/en/master/installation.html#patched-fonts 8 | # 9 | # I recommend picking one of these: 10 | # 11 | # https://github.com/Lokaltog/powerline-fonts 12 | # 13 | # For more advanced awesome, install a nerd fonts patched font (and be sure to 14 | # enable nerd fonts support with `set -g theme_nerd_fonts yes`): 15 | # 16 | # https://github.com/ryanoasis/nerd-fonts 17 | # 18 | # See README.md for setup and configuration options. 19 | # 20 | # ============================== 21 | # Helper methods 22 | # ============================== 23 | 24 | function __bobthefish_basename -d 'basically basename, but faster' 25 | string replace -r '^.*/' '' -- $argv 26 | end 27 | 28 | function __bobthefish_dirname -d 'basically dirname, but faster' 29 | string replace -r '/[^/]+/?$' '' -- $argv 30 | end 31 | 32 | function __bobthefish_pwd -d 'Get a normalized $PWD' 33 | # The pwd builtin accepts `-P` on at least Fish 3.x, but fall back to $PWD if that doesn't work 34 | builtin pwd -P 2>/dev/null 35 | or echo $PWD 36 | end 37 | 38 | # Note that for fish < 3.0 this falls back to unescaped, rather than trying to do something clever /shrug 39 | # After we drop support for older fishies, we can inline this without the fallback. 40 | function __bobthefish_escape_regex -a str -d 'A backwards-compatible `string escape --style=regex` implementation' 41 | string escape --style=regex "$str" 2>/dev/null 42 | or echo "$str" 43 | end 44 | 45 | function __bobthefish_git_branch -S -d 'Get the current git branch (or commitish)' 46 | set -l tag (command git describe --tags --exact-match 2>/dev/null) 47 | and echo "$tag_glyph $tag " 48 | 49 | set -l branch (command git symbolic-ref HEAD 2>/dev/null | string replace -r '^refs/heads/' '') 50 | and begin 51 | [ -n "$theme_git_default_branches" ] 52 | or set -l theme_git_default_branches master main (git config init.defaultBranch) 53 | 54 | [ "$theme_display_git_master_branch" != 'yes' -a "$theme_display_git_default_branch" != 'yes' ] 55 | and contains $branch $theme_git_default_branches 56 | and echo $branch_glyph 57 | and return 58 | 59 | # truncate the middle of the branch name, but only if it's 25+ characters 60 | set -l truncname $branch 61 | [ "$theme_use_abbreviated_branch_name" = 'yes' ] 62 | and set truncname (string replace -r '^(.{17}).{3,}(.{5})$' "\$1…\$2" $branch) 63 | 64 | echo $branch_glyph $truncname 65 | and return 66 | end 67 | 68 | # If we've already shown a tag we don't need to show a detached branch 69 | if [ -z "$tag" ] 70 | set -l branch (command git show-ref --head -s --abbrev | head -n1 2>/dev/null) 71 | echo "$detached_glyph $branch" 72 | end 73 | end 74 | 75 | function __bobthefish_fossil_branch -S -d 'Get the current fossil branch' 76 | set -l branch (command fossil branch 2>/dev/null | string trim --left --chars=' *') 77 | echo "$branch_glyph $branch" 78 | end 79 | 80 | function __bobthefish_hg_branch -S -d 'Get the current hg branch' 81 | set -l branch (command hg branch 2>/dev/null) 82 | set -l book (command hg book | command grep \* | cut -d\ -f3) 83 | echo "$branch_glyph $branch @ $book" 84 | end 85 | 86 | function __bobthefish_pretty_parent -S -a child_dir -d 'Print a parent directory, shortened to fit the prompt' 87 | set -q fish_prompt_pwd_dir_length 88 | or set -l fish_prompt_pwd_dir_length 1 89 | 90 | # Replace $HOME with ~ 91 | set -l real_home ~ 92 | set -l parent_dir (string replace -r '^'(__bobthefish_escape_regex "$real_home")'($|/)' '~$1' (__bobthefish_dirname $child_dir)) 93 | 94 | # Must check whether `$parent_dir = /` if using native dirname 95 | if [ -z "$parent_dir" ] 96 | echo -n / 97 | return 98 | end 99 | 100 | if [ $fish_prompt_pwd_dir_length -eq 0 ] 101 | echo -n "$parent_dir/" 102 | return 103 | end 104 | 105 | string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' "$parent_dir/" 106 | end 107 | 108 | function __bobthefish_ignore_vcs_dir -a real_pwd -d 'Check whether the current directory should be ignored as a VCS segment' 109 | for p in $theme_vcs_ignore_paths 110 | set ignore_path (realpath $p 2>/dev/null) 111 | switch $real_pwd/ 112 | case $ignore_path/\* 113 | echo 1 114 | return 115 | end 116 | end 117 | end 118 | 119 | function __bobthefish_git_project_dir -S -a real_pwd -d 'Print the current git project base directory' 120 | [ "$theme_display_git" = 'no' ] 121 | and return 122 | 123 | command -q git 124 | or return 125 | 126 | set -q theme_vcs_ignore_paths 127 | and [ (__bobthefish_ignore_vcs_dir $real_pwd) ] 128 | and return 129 | 130 | if [ "$theme_git_worktree_support" != 'yes' ] 131 | set -l git_toplevel (command git rev-parse --show-toplevel 2>/dev/null) 132 | 133 | [ -z "$git_toplevel" ] 134 | and return 135 | 136 | ## Support Git under WSL (see #336) 137 | # command -q wslpath 138 | # and set git_toplevel (command wslpath $git_toplevel) 139 | 140 | # If there are no symlinks, just use git toplevel 141 | switch $real_pwd/ 142 | case $git_toplevel/\* 143 | echo $git_toplevel 144 | return 145 | end 146 | 147 | # Otherwise, we need to find the equivalent directory in the $PWD 148 | set -l d $real_pwd 149 | while not [ -z "$d" ] 150 | if [ (realpath "$d") = "$git_toplevel" ] 151 | echo $d 152 | return 153 | end 154 | 155 | [ "$d" = '/' ] 156 | and return 157 | 158 | set d (__bobthefish_dirname $d) 159 | end 160 | return 161 | end 162 | 163 | set -l git_dir (command git rev-parse --git-dir 2>/dev/null) 164 | or return 165 | 166 | pushd $git_dir 167 | set git_dir (__bobthefish_pwd) 168 | popd 169 | 170 | switch $real_pwd/ 171 | case $git_dir/\* 172 | # Nothing works quite right if we're inside the git dir 173 | # TODO: fix the underlying issues then re-enable the stuff below 174 | 175 | # # if we're inside the git dir, sweet. just return that. 176 | # set -l toplevel (command git rev-parse --show-toplevel 2>/dev/null) 177 | # if [ "$toplevel" ] 178 | # switch $git_dir/ 179 | # case $toplevel/\* 180 | # echo $git_dir 181 | # end 182 | # end 183 | return 184 | end 185 | 186 | set -l project_dir (__bobthefish_dirname $git_dir) 187 | 188 | switch $real_pwd/ 189 | case $project_dir/\* 190 | echo $project_dir 191 | return 192 | end 193 | 194 | set project_dir (command git rev-parse --show-toplevel 2>/dev/null) 195 | switch $real_pwd/ 196 | case $project_dir/\* 197 | echo $project_dir 198 | end 199 | end 200 | 201 | function __bobthefish_fossil_project_dir -S -a real_pwd -d 'Print the current fossil project base directory' 202 | [ "$theme_display_fossil" = 'yes' ] 203 | and command -q fossil 204 | and set -f dir (command fossil json status 2>/dev/null | grep localRoot | string split ':' -f2 | string trim --chars='"/,') 205 | or return 206 | 207 | set -q theme_vcs_ignore_paths 208 | and [ (__bobthefish_ignore_vcs_dir $real_pwd) ] 209 | and return 210 | 211 | echo "/$dir" 212 | end 213 | 214 | function __bobthefish_hg_project_dir -S -a real_pwd -d 'Print the current hg project base directory' 215 | [ "$theme_display_hg" = 'yes' ] 216 | and command -q hg 217 | or return 218 | 219 | set -q theme_vcs_ignore_paths 220 | and [ (__bobthefish_ignore_vcs_dir $real_pwd) ] 221 | and return 222 | 223 | set -l d $real_pwd 224 | while not [ -z "$d" ] 225 | if [ -e $d/.hg ] 226 | command hg root --cwd "$d" 2>/dev/null 227 | return 228 | end 229 | 230 | [ "$d" = '/' ] 231 | and return 232 | 233 | set d (__bobthefish_dirname $d) 234 | end 235 | end 236 | 237 | function __bobthefish_project_pwd -S -a project_root_dir -a real_pwd -d 'Print the working directory relative to project root' 238 | set -q theme_project_dir_length 239 | or set -l theme_project_dir_length 0 240 | 241 | set -l project_dir (string replace -r '^'(__bobthefish_escape_regex "$project_root_dir")'($|/)' '' $real_pwd) 242 | 243 | if [ $theme_project_dir_length -eq 0 ] 244 | echo -n $project_dir 245 | return 246 | end 247 | 248 | string replace -ar '(\.?[^/]{'"$theme_project_dir_length"'})[^/]*/' '$1/' $project_dir 249 | end 250 | 251 | function __bobthefish_git_ahead -S -d 'Print the ahead/behind state for the current branch' 252 | if [ "$theme_display_git_ahead_verbose" = 'yes' ] 253 | __bobthefish_git_ahead_verbose 254 | return 255 | end 256 | 257 | set -l ahead 0 258 | set -l behind 0 259 | for line in (command git rev-list --left-right '@{upstream}...HEAD' 2>/dev/null) 260 | switch "$line" 261 | case '>*' 262 | if [ $behind -eq 1 ] 263 | echo '±' 264 | return 265 | end 266 | set ahead 1 267 | case '<*' 268 | if [ $ahead -eq 1 ] 269 | echo "$git_plus_minus_glyph" 270 | return 271 | end 272 | set behind 1 273 | end 274 | end 275 | 276 | if [ $ahead -eq 1 ] 277 | echo "$git_plus_glyph" 278 | else if [ $behind -eq 1 ] 279 | echo "$git_minus_glyph" 280 | end 281 | end 282 | 283 | function __bobthefish_git_ahead_verbose -S -d 'Print a more verbose ahead/behind state for the current branch' 284 | set -l commits (command git rev-list --left-right '@{upstream}...HEAD' 2>/dev/null) 285 | or return 286 | 287 | set -l behind (count (for arg in $commits; echo $arg; end | command grep '^<')) 288 | set -l ahead (count (for arg in $commits; echo $arg; end | command grep -v '^<')) 289 | 290 | switch "$ahead $behind" 291 | case '' # no upstream 292 | case '0 0' # equal to upstream 293 | return 294 | case '* 0' # ahead of upstream 295 | echo "$git_ahead_glyph$ahead" 296 | case '0 *' # behind upstream 297 | echo "$git_behind_glyph$behind" 298 | case '*' # diverged from upstream 299 | echo "$git_ahead_glyph$ahead$git_behind_glyph$behind" 300 | end 301 | end 302 | 303 | function __bobthefish_git_dirty_verbose -S -d 'Print a more verbose dirty state for the current working tree' 304 | set -l changes (command git diff --numstat | awk '{ added += $1; removed += $2 } END { print "+" added "/-" removed }') 305 | or return 306 | 307 | echo "$changes " | string replace -r '(\+0/(-0)?|/-0)' '' 308 | end 309 | 310 | function __bobthefish_git_stashed -S -d 'Print the stashed state for the current branch' 311 | if [ "$theme_display_git_stashed_verbose" = 'yes' ] 312 | set -l stashed (command git rev-list --walk-reflogs --count refs/stash 2>/dev/null) 313 | or return 314 | 315 | echo -n "$git_stashed_glyph$stashed" 316 | else 317 | command git rev-parse --verify --quiet refs/stash >/dev/null 318 | and echo -n "$git_stashed_glyph" 319 | end 320 | end 321 | 322 | 323 | # ============================== 324 | # Segment functions 325 | # ============================== 326 | 327 | function __bobthefish_start_segment -S -d 'Start a prompt segment' 328 | set -l bg $argv[1] 329 | set -e argv[1] 330 | set -l fg $argv[1] 331 | set -e argv[1] 332 | 333 | set_color normal # clear out anything bold or underline... 334 | set_color -b $bg $fg $argv 335 | 336 | switch "$__bobthefish_current_bg" 337 | case '' 338 | # If there's no background, just start one 339 | echo -n ' ' 340 | case "$bg" 341 | # If the background is already the same color, draw a separator 342 | echo -ns $right_arrow_glyph ' ' 343 | case '*' 344 | # otherwise, draw the end of the previous segment and the start of the next 345 | set_color $__bobthefish_current_bg 346 | echo -ns $right_black_arrow_glyph ' ' 347 | set_color $fg $argv 348 | end 349 | 350 | set __bobthefish_current_bg $bg 351 | end 352 | 353 | function __bobthefish_path_segment -S -a segment_dir -a path_type -d 'Display a shortened form of a directory' 354 | set -l segment_color $color_path 355 | set -l segment_basename_color $color_path_basename 356 | 357 | if not [ -w "$segment_dir" ] 358 | set segment_color $color_path_nowrite 359 | set segment_basename_color $color_path_nowrite_basename 360 | end 361 | 362 | __bobthefish_start_segment $segment_color 363 | 364 | set -l directory 365 | set -l parent 366 | 367 | switch "$segment_dir" 368 | case / 369 | set directory '/' 370 | case "$HOME" 371 | set directory '~' 372 | case '*' 373 | set parent (__bobthefish_pretty_parent "$segment_dir") 374 | set directory (__bobthefish_basename "$segment_dir") 375 | end 376 | 377 | [ "$theme_show_project_parent" != "no" -o "$path_type" != "project" ] 378 | and echo -n $parent 379 | 380 | set_color -b $segment_basename_color 381 | echo -ns $directory ' ' 382 | end 383 | 384 | function __bobthefish_finish_segments -S -d 'Close open prompt segments' 385 | if [ -n "$__bobthefish_current_bg" ] 386 | set_color normal 387 | set_color $__bobthefish_current_bg 388 | echo -ns $right_black_arrow_glyph ' ' 389 | end 390 | 391 | if [ "$theme_newline_cursor" = 'yes' ] 392 | echo -ens "\n" 393 | set_color $fish_color_autosuggestion 394 | 395 | if set -q theme_newline_prompt 396 | echo -ens "$theme_newline_prompt" 397 | else if [ "$theme_powerline_fonts" = 'no' -a "$theme_nerd_fonts" != 'yes' ] 398 | echo -ns '> ' 399 | else 400 | echo -ns "$right_arrow_glyph " 401 | end 402 | else if [ "$theme_newline_cursor" = 'clean' ] 403 | echo -ens "\n" 404 | end 405 | 406 | set_color normal 407 | set __bobthefish_current_bg 408 | end 409 | 410 | 411 | # ============================== 412 | # Status segment 413 | # ============================== 414 | 415 | function __bobthefish_prompt_status -S -a last_status -d 'Display flags for a non-zero exit status, private mode, root user, and background jobs' 416 | set -l nonzero 417 | set -l superuser 418 | set -l bg_jobs 419 | 420 | # Last exit was nonzero 421 | [ $last_status -ne 0 ] 422 | and set nonzero 1 423 | 424 | # If superuser (uid == 0) 425 | # 426 | # Note that iff the current user is root and '/' is not writeable by root this 427 | # will be wrong. But I can't think of a single reason that would happen, and 428 | # it is literally 99.5% faster to check it this way, so that's a tradeoff I'm 429 | # willing to make. 430 | [ -w / -o -w /private/ ] 431 | and [ (id -u) -eq 0 ] 432 | and set superuser 1 433 | 434 | # Jobs display 435 | if set -q AUTOJUMP_SOURCED 436 | # Autojump special case: check if there are jobs besides the `autojump` 437 | # job, since that one is (briefly) backgrounded every time we `cd` 438 | set bg_jobs (jobs -c | string match -v --regex '(Command|autojump)' | wc -l) 439 | [ "$bg_jobs" -eq 0 ] 440 | and set bg_jobs # clear it out so it doesn't show when `0` 441 | else 442 | if [ "$theme_display_jobs_verbose" = 'yes' ] 443 | set bg_jobs (jobs -p | wc -l) 444 | [ "$bg_jobs" -eq 0 ] 445 | and set bg_jobs # clear it out so it doesn't show when `0` 446 | else 447 | # `jobs -p` is faster if we redirect to /dev/null, because it exits 448 | # after the first match. We'll use that unless the user wants to 449 | # display the actual job count 450 | jobs -p >/dev/null 451 | and set bg_jobs 1 452 | end 453 | end 454 | 455 | if [ "$nonzero" -o "$fish_private_mode" -o "$superuser" -o "$bg_jobs" ] 456 | __bobthefish_start_segment $color_initial_segment_exit 457 | if [ "$nonzero" ] 458 | set_color normal 459 | set_color -b $color_initial_segment_exit 460 | if [ "$theme_show_exit_status" = 'yes' ] 461 | echo -ns $last_status ' ' 462 | else 463 | echo -n $nonzero_exit_glyph 464 | end 465 | end 466 | 467 | if [ "$fish_private_mode" ] 468 | set_color normal 469 | set_color -b $color_initial_segment_private 470 | echo -n $private_glyph 471 | end 472 | 473 | if [ "$superuser" ] 474 | set_color normal 475 | if [ -z "$FAKEROOTKEY" ] 476 | set_color -b $color_initial_segment_su 477 | else 478 | set_color -b $color_initial_segment_exit 479 | end 480 | 481 | echo -n $superuser_glyph 482 | end 483 | 484 | if [ "$bg_jobs" ] 485 | set_color normal 486 | set_color -b $color_initial_segment_jobs 487 | if [ "$theme_display_jobs_verbose" = 'yes' ] 488 | echo -ns $bg_job_glyph $bg_jobs ' ' 489 | else 490 | echo -n $bg_job_glyph 491 | end 492 | end 493 | end 494 | end 495 | 496 | 497 | # ============================== 498 | # Container and VM segments 499 | # ============================== 500 | 501 | function __bobthefish_prompt_vagrant -S -d 'Display Vagrant status' 502 | [ "$theme_display_vagrant" = 'yes' -a -f Vagrantfile ] 503 | or return 504 | 505 | # .vagrant/machines/$machine/$provider/id 506 | for file in .vagrant/machines/*/*/id 507 | read -l id <"$file" 508 | 509 | if [ -n "$id" ] 510 | switch "$file" 511 | case '*/virtualbox/id' 512 | __bobthefish_prompt_vagrant_vbox $id 513 | case '*/vmware_fusion/id' 514 | __bobthefish_prompt_vagrant_vmware $id 515 | case '*/parallels/id' 516 | __bobthefish_prompt_vagrant_parallels $id 517 | end 518 | end 519 | end 520 | end 521 | 522 | function __bobthefish_prompt_vagrant_vbox -S -a id -d 'Display VirtualBox Vagrant status' 523 | set -l vagrant_status 524 | set -l vm_status (VBoxManage showvminfo --machinereadable $id 2>/dev/null | command grep 'VMState=' | tr -d '"' | cut -d '=' -f 2) 525 | 526 | switch "$vm_status" 527 | case 'running' 528 | set vagrant_status "$vagrant_status$vagrant_running_glyph" 529 | case 'poweroff' 530 | set vagrant_status "$vagrant_status$vagrant_poweroff_glyph" 531 | case 'aborted' 532 | set vagrant_status "$vagrant_status$vagrant_aborted_glyph" 533 | case 'saved' 534 | set vagrant_status "$vagrant_status$vagrant_saved_glyph" 535 | case 'stopping' 536 | set vagrant_status "$vagrant_status$vagrant_stopping_glyph" 537 | case '' 538 | set vagrant_status "$vagrant_status$vagrant_unknown_glyph" 539 | end 540 | 541 | [ -z "$vagrant_status" ] 542 | and return 543 | 544 | __bobthefish_start_segment $color_vagrant 545 | echo -ns $vagrant_status ' ' 546 | end 547 | 548 | function __bobthefish_prompt_vagrant_vmware -S -a id -d 'Display VMWare Vagrant status' 549 | set -l vagrant_status 550 | if [ (pgrep -f "$id") ] 551 | set vagrant_status "$vagrant_status$vagrant_running_glyph" 552 | else 553 | set vagrant_status "$vagrant_status$vagrant_poweroff_glyph" 554 | end 555 | 556 | [ -z "$vagrant_status" ] 557 | and return 558 | 559 | __bobthefish_start_segment $color_vagrant 560 | echo -ns $vagrant_status ' ' 561 | end 562 | 563 | function __bobthefish_prompt_vagrant_parallels -S -d 'Display Parallels Vagrant status' 564 | set -l vagrant_status 565 | set -l vm_status (prlctl list $id -o status 2>/dev/null | command tail -1) 566 | 567 | switch "$vm_status" 568 | case 'running' 569 | set vagrant_status "$vagrant_status$vagrant_running_glyph" 570 | case 'stopped' 571 | set vagrant_status "$vagrant_status$vagrant_poweroff_glyph" 572 | case 'paused' 573 | set vagrant_status "$vagrant_status$vagrant_saved_glyph" 574 | case 'suspended' 575 | set vagrant_status "$vagrant_status$vagrant_saved_glyph" 576 | case 'stopping' 577 | set vagrant_status "$vagrant_status$vagrant_stopping_glyph" 578 | case '' 579 | set vagrant_status "$vagrant_status$vagrant_unknown_glyph" 580 | end 581 | 582 | [ -z "$vagrant_status" ] 583 | and return 584 | 585 | __bobthefish_start_segment $color_vagrant 586 | echo -ns $vagrant_status ' ' 587 | end 588 | 589 | function __bobthefish_prompt_docker -S -d 'Display Docker machine name' 590 | [ "$theme_display_docker_machine" = 'no' -o -z "$DOCKER_MACHINE_NAME" ] 591 | and return 592 | 593 | __bobthefish_start_segment $color_vagrant 594 | echo -ns $DOCKER_MACHINE_NAME ' ' 595 | end 596 | 597 | function __bobthefish_k8s_context -S -d 'Get the current k8s context' 598 | set -l config_paths "$HOME/.kube/config" 599 | [ -n "$KUBECONFIG" ] 600 | and set config_paths (string split ':' "$KUBECONFIG") $config_paths 601 | 602 | for file in $config_paths 603 | [ -f "$file" ] 604 | or continue 605 | 606 | while read -l key val 607 | if [ "$key" = 'current-context:' ] 608 | set -l context (string trim -c '"\' ' -- $val) 609 | [ -z "$context" ] 610 | and return 1 611 | 612 | echo $context 613 | return 614 | end 615 | end <$file 616 | end 617 | 618 | return 1 619 | end 620 | 621 | function __bobthefish_k8s_namespace -S -d 'Get the current k8s namespace' 622 | kubectl config view --minify --output "jsonpath={..namespace}" 623 | end 624 | 625 | function __bobthefish_prompt_k8s_context -S -d 'Show current Kubernetes context' 626 | [ "$theme_display_k8s_context" = 'yes' ] 627 | or return 628 | 629 | set -l context (__bobthefish_k8s_context) 630 | or return 631 | 632 | [ "$theme_display_k8s_namespace" = 'yes' ] 633 | and set -l namespace (__bobthefish_k8s_namespace) 634 | 635 | [ -z "$context" -o "$context" = 'default' ] 636 | and [ -z "$namespace" -o "$namespace" = 'default' ] 637 | and return 638 | 639 | set -l segment $k8s_glyph ' ' 640 | [ "$context" != 'default' ] 641 | and set segment $segment $context 642 | [ "$namespace" != 'default' ] 643 | and set segment $segment ':' $namespace 644 | 645 | __bobthefish_start_segment $color_k8s 646 | echo -ns $segment ' ' 647 | end 648 | 649 | 650 | # ============================== 651 | # Cloud Tools 652 | # ============================== 653 | 654 | function __bobthefish_prompt_aws_vault_profile -S -d 'Show AWS Vault profile' 655 | [ "$theme_display_aws_vault_profile" = 'yes' ] 656 | or return 657 | 658 | [ -n "$AWS_VAULT" -a -n "$AWS_CREDENTIAL_EXPIRATION" ] 659 | or return 660 | 661 | set -l profile $AWS_VAULT 662 | 663 | set -l now (date --utc +%s) 664 | set -l expiry (date -d "$AWS_CREDENTIAL_EXPIRATION" +%s) 665 | set -l diff_mins (math "floor(( $expiry - $now ) / 60)") 666 | 667 | set -l diff_time $diff_mins"m" 668 | [ $diff_mins -le 0 ] 669 | and set -l diff_time '0m' 670 | [ $diff_mins -ge 60 ] 671 | and set -l diff_time (math "floor($diff_mins / 60)")"h"(math "$diff_mins % 60")"m" 672 | 673 | set -l segment $profile ' (' $diff_time ')' 674 | set -l status_color $color_aws_vault 675 | [ $diff_mins -le 0 ] 676 | and set -l status_color $color_aws_vault_expired 677 | 678 | __bobthefish_start_segment $status_color 679 | echo -ns $segment ' ' 680 | end 681 | 682 | 683 | # ============================== 684 | # User / hostname info segments 685 | # ============================== 686 | 687 | # Polyfill for fish < 2.5.0 688 | if not type -q prompt_hostname 689 | if not set -q __bobthefish_prompt_hostname 690 | set -g __bobthefish_prompt_hostname (uname -n | string replace -r '\..*' '') 691 | end 692 | 693 | function prompt_hostname 694 | echo $__bobthefish_prompt_hostname 695 | end 696 | end 697 | 698 | function __bobthefish_prompt_user -S -d 'Display current user and hostname' 699 | [ "$theme_display_user" = 'yes' -o \( "$theme_display_user" != 'no' -a -n "$SSH_CLIENT" \) -o \( -n "$default_user" -a "$USER" != "$default_user" \) ] 700 | and set -l display_user 701 | 702 | [ "$theme_display_sudo_user" = 'yes' -a -n "$SUDO_USER" ] 703 | and set -l display_sudo_user 704 | 705 | [ "$theme_display_hostname" = 'yes' -o \( "$theme_display_hostname" != 'no' -a -n "$SSH_CLIENT" \) ] 706 | and set -l display_hostname 707 | 708 | if set -q display_user 709 | __bobthefish_start_segment $color_username 710 | echo -ns (whoami) 711 | end 712 | 713 | if set -q display_sudo_user 714 | if set -q display_user 715 | echo -ns ' ' 716 | else 717 | __bobthefish_start_segment $color_username 718 | end 719 | echo -ns "($SUDO_USER)" 720 | end 721 | 722 | if set -q display_hostname 723 | if set -q display_user 724 | or set -q display_sudo_user 725 | # reset colors without starting a new segment... 726 | # (so we can have a bold username and non-bold hostname) 727 | set_color normal 728 | set_color -b $color_hostname[1] $color_hostname[2..-1] 729 | echo -ns '@' (prompt_hostname) 730 | else 731 | __bobthefish_start_segment $color_hostname 732 | echo -ns (prompt_hostname) 733 | end 734 | end 735 | 736 | set -q display_user 737 | or set -q display_sudo_user 738 | or set -q display_hostname 739 | and echo -ns ' ' 740 | end 741 | 742 | 743 | # ============================== 744 | # Virtual environment segments 745 | # ============================== 746 | 747 | function __bobthefish_rvm_parse_ruby -S -a ruby_string -a scope -d 'Parse RVM Ruby string' 748 | # Function arguments: 749 | # - 'ruby-2.2.3@rails', 'jruby-1.7.19'... 750 | # - 'default' or 'current' 751 | set -l IFS @ 752 | echo "$ruby_string" | read __ruby __rvm_{$scope}_ruby_gemset __ 753 | set IFS - 754 | echo "$__ruby" | read __rvm_{$scope}_ruby_interpreter __rvm_{$scope}_ruby_version __ 755 | set -e __ruby 756 | set -e __ 757 | end 758 | 759 | function __bobthefish_rvm_info -S -d 'Current Ruby information from RVM' 760 | # look for rvm install path 761 | set -q rvm_path 762 | or set -l rvm_path ~/.rvm /usr/local/rvm 763 | 764 | # More `sed`/`grep`/`cut` magic... 765 | set -l __rvm_default_ruby (grep GEM_HOME $rvm_path/environments/default 2>/dev/null | sed -e"s/'//g" | sed -e's/.*\///') 766 | set -l __rvm_current_ruby (rvm-prompt i v g) 767 | 768 | [ "$__rvm_default_ruby" = "$__rvm_current_ruby" ] 769 | and return 770 | 771 | set -l __rvm_default_ruby_gemset 772 | set -l __rvm_default_ruby_interpreter 773 | set -l __rvm_default_ruby_version 774 | set -l __rvm_current_ruby_gemset 775 | set -l __rvm_current_ruby_interpreter 776 | set -l __rvm_current_ruby_version 777 | 778 | # Parse default and current Rubies to global variables 779 | __bobthefish_rvm_parse_ruby $__rvm_default_ruby default 780 | __bobthefish_rvm_parse_ruby $__rvm_current_ruby current 781 | # Show unobtrusive RVM prompt 782 | 783 | # If interpreter differs form default interpreter, show everything: 784 | if [ "$__rvm_default_ruby_interpreter" != "$__rvm_current_ruby_interpreter" ] 785 | if [ "$__rvm_current_ruby_gemset" = 'global' ] 786 | rvm-prompt i v 787 | else 788 | rvm-prompt i v g 789 | end 790 | # If version differs form default version 791 | else if [ "$__rvm_default_ruby_version" != "$__rvm_current_ruby_version" ] 792 | if [ "$__rvm_current_ruby_gemset" = 'global' ] 793 | rvm-prompt v 794 | else 795 | rvm-prompt v g 796 | end 797 | # If gemset differs form default or 'global' gemset, just show it 798 | else if [ "$__rvm_default_ruby_gemset" != "$__rvm_current_ruby_gemset" ] 799 | rvm-prompt g 800 | end 801 | end 802 | 803 | function __bobthefish_prompt_rubies -S -d 'Display current Ruby information' 804 | [ "$theme_display_ruby" = 'no' ] 805 | and return 806 | 807 | set -l ruby_version 808 | if command -q rvm-prompt 809 | set ruby_version (__bobthefish_rvm_info) 810 | else if command -q rbenv 811 | set ruby_version (rbenv version-name) 812 | # Don't show global ruby version... 813 | set -q RBENV_ROOT 814 | or set -l RBENV_ROOT $HOME/.rbenv 815 | 816 | [ -e "$RBENV_ROOT/version" ] 817 | and read -l global_ruby_version <"$RBENV_ROOT/version" 818 | 819 | [ "$global_ruby_version" ] 820 | or set -l global_ruby_version system 821 | 822 | [ "$ruby_version" = "$global_ruby_version" ] 823 | and return 824 | else if type -q chruby # chruby is implemented as a function, so using type -q is intentional 825 | set ruby_version $RUBY_VERSION 826 | else if command -q asdf 827 | set -l asdf_current_ruby (asdf current ruby 2>/dev/null) 828 | or return 829 | 830 | echo "$asdf_current_ruby" | read -l _asdf_plugin asdf_ruby_version asdf_provenance 831 | 832 | # If asdf changes their ruby version provenance format, update this to match 833 | [ (string trim -- "$asdf_provenance") = "$HOME/.tool-versions" ] 834 | and return 835 | 836 | set ruby_version $asdf_ruby_version 837 | end 838 | 839 | [ -z "$ruby_version" ] 840 | and return 841 | 842 | __bobthefish_start_segment $color_rvm 843 | echo -ns $ruby_glyph $ruby_version ' ' 844 | end 845 | 846 | function __bobthefish_prompt_golang -S -a real_pwd -d 'Display current Go information' 847 | # setting is 'no', don't display the prompt 848 | [ "$theme_display_go" = 'no' ] 849 | and return 850 | 851 | # find the closest go.mod 852 | set -l gomod_version "0" 853 | set -l d $real_pwd 854 | while not [ -z "$d" ] 855 | if [ -e $d/go.mod ] 856 | grep "^go " "$d/go.mod" | read __ gomod_version 857 | break 858 | end 859 | 860 | [ "$d" = "/" ] 861 | and return 862 | 863 | set d (__bobthefish_dirname $d) 864 | end 865 | 866 | # no go.mod, not in a go project, don't display the prompt 867 | if [ "$gomod_version" = "0" ] 868 | return 869 | end 870 | 871 | # check if there's a Go executable 872 | set -l no_go_installed "0" 873 | set -l actual_go_version "0" 874 | set -l high_enough_version "0" 875 | if command -q go 876 | set actual_go_version (go version | string replace --filter -r 'go version go(\\d+\\.\\d+(?:\\.\\d+)?).*' '$1') 877 | if printf "%s\n%s" "$gomod_version" "$actual_go_version" | sort --check=silent --version-sort 878 | set high_enough_version "1" 879 | end 880 | else 881 | set no_go_installed "1" 882 | end 883 | 884 | if [ "$high_enough_version" = "1" ] 885 | __bobthefish_start_segment $color_virtualgo 886 | else 887 | __bobthefish_start_segment $color_rvm 888 | end 889 | 890 | echo -ns $go_glyph 891 | echo -ns "$gomod_version " 892 | 893 | # showing the prompt -- but plain ( for 'yes' ) or verbose? 894 | if [ "$theme_display_go" = "verbose" ] 895 | if [ "$actual_go_version" != "0" ] 896 | # show the prompt with the required version AND the currently available 897 | # version; same color rules as above 898 | echo -ns " ($actual_go_version)" 899 | end 900 | end 901 | end 902 | 903 | function __bobthefish_virtualenv_python_version -S -d 'Get current Python version' 904 | switch (python --version 2>&1 | tr '\n' ' ') 905 | case 'Python 2*PyPy*' 906 | echo $pypy_glyph 907 | case 'Python 3*PyPy*' 908 | echo -s $pypy_glyph $superscript_glyph[3] 909 | case 'Python 2*' 910 | echo $superscript_glyph[2] 911 | case 'Python 3*' 912 | echo $superscript_glyph[3] 913 | end 914 | end 915 | 916 | function __bobthefish_prompt_virtualfish -S -d "Display current Python virtual environment (only for virtualfish, virtualenv's activate.fish changes prompt by itself) or conda environment." 917 | command -q python 918 | or return 919 | 920 | [ "$theme_display_virtualenv" = 'no' -o -z "$VIRTUAL_ENV" -a -z "$CONDA_DEFAULT_ENV" ] 921 | and return 922 | 923 | set -l version_glyph (__bobthefish_virtualenv_python_version) 924 | set -l prompt_style 'default' 925 | 926 | if [ "$version_glyph" ] 927 | __bobthefish_start_segment $color_virtualfish 928 | if string match -q "Python 2*" (python --version 2>&1 | string trim) 929 | set prompt_style 'verbose' 930 | else if [ "$theme_display_virtualenv" = 'verbose' ] 931 | set prompt_style 'verbose' 932 | end 933 | 934 | if [ "$prompt_style" = 'verbose' ] 935 | echo -ns $virtualenv_glyph $version_glyph ' ' 936 | else 937 | echo -ns $virtualenv_glyph 938 | end 939 | 940 | end 941 | 942 | if [ "$VIRTUAL_ENV" ] 943 | echo -ns (basename "$VIRTUAL_ENV") ' ' 944 | else if [ "$CONDA_DEFAULT_ENV" ] 945 | echo -ns (basename "$CONDA_DEFAULT_ENV") ' ' 946 | end 947 | end 948 | 949 | function __bobthefish_prompt_virtualgo -S -d 'Display current Go virtual environment' 950 | [ "$theme_display_virtualgo" = 'no' -o -z "$VIRTUALGO" ] 951 | and return 952 | 953 | __bobthefish_start_segment $color_virtualgo 954 | echo -ns $go_glyph ' ' (basename "$VIRTUALGO") ' ' 955 | set_color normal 956 | end 957 | 958 | function __bobthefish_prompt_desk -S -d 'Display current desk environment' 959 | [ "$theme_display_desk" = 'no' -o -z "$DESK_ENV" ] 960 | and return 961 | 962 | __bobthefish_start_segment $color_desk 963 | echo -ns $desk_glyph ' ' (basename -a -s '.fish' "$DESK_ENV") ' ' 964 | set_color normal 965 | end 966 | 967 | function __bobthefish_prompt_find_file_up -S -d 'Find file(s), going up the parent directories' 968 | set -l dir "$argv[1]" 969 | set -l files $argv[2..-1] 970 | 971 | if test -z "$dir" 972 | or test -z "$files" 973 | return 1 974 | end 975 | 976 | while [ "$dir" ] 977 | for f in $files 978 | if [ -e "$dir/$f" ] 979 | return 980 | end 981 | end 982 | 983 | [ "$dir" = '/' ] 984 | and return 1 985 | 986 | set dir (__bobthefish_dirname "$dir") 987 | end 988 | return 1 989 | end 990 | 991 | function __bobthefish_prompt_node -S -d 'Display current node version' 992 | set -l should_show 993 | 994 | if [ "$theme_display_node" = 'always' -o "$theme_display_nvm" = 'yes' ] 995 | set should_show 1 996 | else if [ "$theme_display_node" = 'yes' ] 997 | __bobthefish_prompt_find_file_up "$PWD" package.json .nvmrc .node-version 998 | and set should_show 1 999 | end 1000 | 1001 | [ -z "$should_show" ] 1002 | and return 1003 | 1004 | set -l node_manager 1005 | set -l node_manager_dir 1006 | 1007 | if type -q nvm 1008 | set node_manager 'nvm' 1009 | set node_manager_dir $NVM_DIR 1010 | else if command -q fnm 1011 | set node_manager 'fnm' 1012 | set node_manager_dir $FNM_DIR 1013 | end 1014 | 1015 | [ -n "$node_manager_dir" ] 1016 | or return 1017 | 1018 | set -l node_version ("$node_manager" current 2> /dev/null) 1019 | 1020 | [ -z $node_version -o "$node_version" = 'none' -o "$node_version" = 'system' ] 1021 | and return 1022 | 1023 | [ -n "$color_nvm" ] 1024 | and set -x color_node $color_nvm 1025 | 1026 | __bobthefish_start_segment $color_node 1027 | echo -ns $node_glyph $node_version ' ' 1028 | set_color normal 1029 | end 1030 | 1031 | function __bobthefish_prompt_nix -S -d 'Display current nix environment' 1032 | [ "$theme_display_nix" = 'no' -o -z "$IN_NIX_SHELL" ] 1033 | and return 1034 | 1035 | __bobthefish_start_segment $color_nix 1036 | echo -ns $nix_glyph $IN_NIX_SHELL ' ' 1037 | 1038 | set_color normal 1039 | end 1040 | 1041 | # ============================== 1042 | # VCS segments 1043 | # ============================== 1044 | 1045 | function __bobthefish_prompt_fossil -S -a fossil_root_dir -a real_pwd -d 'Display the actual fossil state' 1046 | set -f fossil_statuses (command fossil changes --differ 2>/dev/null | cut -d' ' -f1 | sort -u) 1047 | 1048 | # Fossil doesn't really stage changes; untracked files are ignored, tracked files are committed by default 1049 | # It also syncs by default when you commit, and monitors for conflicts (which will be reported here) 1050 | for line in $fossil_statuses 1051 | switch $line 1052 | case ADDED UPDATED EDITED DELETED RENAMED 1053 | # These can really just all be dirty, then 1054 | set -f dirty $git_dirty_glyph 1055 | case EXTRA 1056 | set -f new $git_untracked_glyph 1057 | case CONFLICT 1058 | set -f conflict '!' 1059 | end 1060 | end 1061 | 1062 | set -f flags "$dirty$new$conflict" 1063 | 1064 | [ "$flags" ] 1065 | and set flags " $flags" 1066 | 1067 | set -l flag_colors $color_repo 1068 | if [ "$dirty" ] 1069 | set flag_colors $color_repo_dirty 1070 | end 1071 | 1072 | __bobthefish_path_segment $fossil_root_dir project 1073 | 1074 | __bobthefish_start_segment $flag_colors 1075 | echo -ns $fossil_glyph ' ' 1076 | 1077 | echo -ns (__bobthefish_fossil_branch) $flags ' ' 1078 | set_color normal 1079 | 1080 | set -l project_pwd (__bobthefish_project_pwd $fossil_root_dir $real_pwd) 1081 | if [ "$project_pwd" ] 1082 | if [ -w "$real_pwd" ] 1083 | __bobthefish_start_segment $color_path 1084 | else 1085 | __bobthefish_start_segment $color_path_nowrite 1086 | end 1087 | 1088 | echo -ns $project_pwd ' ' 1089 | end 1090 | end 1091 | 1092 | function __bobthefish_prompt_hg -S -a hg_root_dir -a real_pwd -d 'Display the actual hg state' 1093 | set -l dirty (command hg stat; or echo -n '*') 1094 | 1095 | set -l flags "$dirty" 1096 | [ "$flags" ] 1097 | and set flags '' 1098 | 1099 | set -l flag_colors $color_repo 1100 | if [ "$dirty" ] 1101 | set flag_colors $color_repo_dirty 1102 | end 1103 | 1104 | __bobthefish_path_segment $hg_root_dir project 1105 | 1106 | __bobthefish_start_segment $flag_colors 1107 | echo -ns $hg_glyph ' ' 1108 | 1109 | __bobthefish_start_segment $flag_colors 1110 | echo -ns (__bobthefish_hg_branch) $flags ' ' 1111 | set_color normal 1112 | 1113 | set -l project_pwd (__bobthefish_project_pwd $hg_root_dir $real_pwd) 1114 | if [ "$project_pwd" ] 1115 | if [ -w "$real_pwd" ] 1116 | __bobthefish_start_segment $color_path 1117 | else 1118 | __bobthefish_start_segment $color_path_nowrite 1119 | end 1120 | 1121 | echo -ns $project_pwd ' ' 1122 | end 1123 | end 1124 | 1125 | function __bobthefish_prompt_screen -S -d 'Display the screen name' 1126 | [ "$theme_display_screen" = 'no' -o -z "$STY" ] 1127 | and return 1128 | 1129 | __bobthefish_start_segment $color_screen 1130 | echo -ns (string split "." -- $STY)[2] ' ' 1131 | set_color normal 1132 | end 1133 | 1134 | function __bobthefish_prompt_git -S -a git_root_dir -a real_pwd -d 'Display the actual git state' 1135 | set -l dirty '' 1136 | if [ "$theme_display_git_dirty" != 'no' ] 1137 | set -l show_dirty (command git config --bool bash.showDirtyState 2>/dev/null) 1138 | if [ "$show_dirty" != 'false' ] 1139 | set dirty (command git diff --no-ext-diff --quiet --exit-code 2>/dev/null; or echo -n "$git_dirty_glyph") 1140 | if [ "$dirty" -a "$theme_display_git_dirty_verbose" = 'yes' ] 1141 | set dirty "$dirty"(__bobthefish_git_dirty_verbose) 1142 | end 1143 | end 1144 | end 1145 | 1146 | set -l staged (command git diff --cached --no-ext-diff --quiet --exit-code 2>/dev/null; or echo -n "$git_staged_glyph") 1147 | set -l stashed (__bobthefish_git_stashed) 1148 | set -l ahead (__bobthefish_git_ahead) 1149 | 1150 | set -l new '' 1151 | if [ "$theme_display_git_untracked" != 'no' ] 1152 | set -l show_untracked (command git config --bool bash.showUntrackedFiles 2>/dev/null) 1153 | if [ "$show_untracked" != 'false' ] 1154 | set new (command git ls-files --other --exclude-standard --directory --no-empty-directory "$git_root_dir" 2>/dev/null) 1155 | if [ "$new" ] 1156 | set new "$git_untracked_glyph" 1157 | end 1158 | end 1159 | end 1160 | 1161 | set -l flags "$dirty$staged$stashed$ahead$new" 1162 | 1163 | [ "$flags" ] 1164 | and set flags " $flags" 1165 | 1166 | set -l flag_colors $color_repo 1167 | if [ "$dirty" ] 1168 | set flag_colors $color_repo_dirty 1169 | else if [ "$staged" ] 1170 | set flag_colors $color_repo_staged 1171 | end 1172 | 1173 | __bobthefish_path_segment $git_root_dir project 1174 | 1175 | __bobthefish_start_segment $flag_colors 1176 | echo -ns (__bobthefish_git_branch) $flags ' ' 1177 | set_color normal 1178 | 1179 | if [ "$theme_git_worktree_support" != 'yes' ] 1180 | set -l project_pwd (__bobthefish_project_pwd $git_root_dir $real_pwd) 1181 | if [ "$project_pwd" ] 1182 | if [ -w "$real_pwd" ] 1183 | __bobthefish_start_segment $color_path 1184 | else 1185 | __bobthefish_start_segment $color_path_nowrite 1186 | end 1187 | 1188 | echo -ns $project_pwd ' ' 1189 | end 1190 | return 1191 | end 1192 | 1193 | set -l project_pwd (command git rev-parse --show-prefix 2>/dev/null | string trim --right --chars=/) 1194 | set -l work_dir (command git rev-parse --show-toplevel 2>/dev/null) 1195 | 1196 | # only show work dir if it's a parent… 1197 | if [ "$work_dir" ] 1198 | switch $real_pwd/ 1199 | case $work_dir/\* 1200 | string match "$git_root_dir*" $work_dir >/dev/null 1201 | and set work_dir (string sub -s (math 1 + (string length $git_root_dir)) $work_dir) 1202 | case \* 1203 | set -e work_dir 1204 | end 1205 | end 1206 | 1207 | if [ "$project_pwd" -o "$work_dir" ] 1208 | set -l colors $color_path 1209 | if not [ -w "$real_pwd" ] 1210 | set colors $color_path_nowrite 1211 | end 1212 | 1213 | __bobthefish_start_segment $colors 1214 | 1215 | # handle work_dir != project dir 1216 | if [ "$work_dir" ] 1217 | set -l work_parent (__bobthefish_dirname $work_dir) 1218 | if [ "$work_parent" ] 1219 | echo -n "$work_parent/" 1220 | end 1221 | 1222 | set_color normal 1223 | set_color -b $color_repo_work_tree 1224 | echo -n (__bobthefish_basename $work_dir) 1225 | 1226 | set_color normal 1227 | set_color -b $colors 1228 | [ "$project_pwd" ] 1229 | and echo -n '/' 1230 | end 1231 | 1232 | echo -ns $project_pwd ' ' 1233 | else 1234 | set project_pwd $real_pwd 1235 | 1236 | string match "$git_root_dir*" $project_pwd >/dev/null 1237 | and set project_pwd (string sub -s (math 1 + (string length $git_root_dir)) $project_pwd) 1238 | 1239 | set project_pwd (string trim --left --chars=/ -- $project_pwd) 1240 | 1241 | if [ "$project_pwd" ] 1242 | set -l colors $color_path 1243 | if not [ -w "$real_pwd" ] 1244 | set colors $color_path_nowrite 1245 | end 1246 | 1247 | __bobthefish_start_segment $colors 1248 | 1249 | echo -ns $project_pwd ' ' 1250 | end 1251 | end 1252 | end 1253 | 1254 | function __bobthefish_prompt_dir -S -a real_pwd -d 'Display a shortened form of the current directory' 1255 | __bobthefish_path_segment "$real_pwd" pwd 1256 | end 1257 | 1258 | # Polyfill for fish < 3.5.0 1259 | function __bobthefish_closest_parent -S 1260 | if builtin -q path 1261 | echo (path sort -r $argv)[1] 1262 | else 1263 | string join \n $argv | awk '{ print length, $0 }' | sort -nsr | head -1 | cut -d" " -f2- 1264 | end 1265 | end 1266 | 1267 | 1268 | # ============================== 1269 | # Apply theme 1270 | # ============================== 1271 | 1272 | function fish_prompt -d 'bobthefish, a fish theme optimized for awesome' 1273 | # Save the last status for later (do this before anything else) 1274 | set -l last_status $status 1275 | 1276 | # Use a simple prompt on dumb terminals. 1277 | if [ "$TERM" = 'dumb' ] 1278 | echo '> ' 1279 | return 1280 | end 1281 | 1282 | __bobthefish_glyphs 1283 | __bobthefish_colors $theme_color_scheme 1284 | 1285 | type -q bobthefish_colors 1286 | and bobthefish_colors 1287 | 1288 | # Start each line with a blank slate 1289 | set -l __bobthefish_current_bg 1290 | 1291 | set -l real_pwd (__bobthefish_pwd) 1292 | 1293 | # Status flags and input mode 1294 | __bobthefish_prompt_status $last_status 1295 | 1296 | # User / hostname info 1297 | __bobthefish_prompt_user 1298 | 1299 | # Screen 1300 | __bobthefish_prompt_screen 1301 | 1302 | # Containers and VMs 1303 | __bobthefish_prompt_vagrant 1304 | __bobthefish_prompt_docker 1305 | __bobthefish_prompt_k8s_context 1306 | 1307 | # Cloud Tools 1308 | __bobthefish_prompt_aws_vault_profile 1309 | 1310 | # Virtual environments 1311 | __bobthefish_prompt_nix 1312 | __bobthefish_prompt_desk 1313 | __bobthefish_prompt_rubies 1314 | __bobthefish_prompt_golang $real_pwd 1315 | __bobthefish_prompt_virtualfish 1316 | __bobthefish_prompt_virtualgo 1317 | __bobthefish_prompt_node 1318 | 1319 | 1320 | # VCS 1321 | set -l git_root_dir (__bobthefish_git_project_dir $real_pwd) 1322 | set -l hg_root_dir (__bobthefish_hg_project_dir $real_pwd) 1323 | set -l fossil_root_dir (__bobthefish_fossil_project_dir $real_pwd) 1324 | 1325 | # only show the closest parent 1326 | switch (__bobthefish_closest_parent "$git_root_dir" "$hg_root_dir" "$fossil_root_dir") 1327 | case '' 1328 | __bobthefish_prompt_dir $real_pwd 1329 | case "$git_root_dir" 1330 | __bobthefish_prompt_git $git_root_dir $real_pwd 1331 | case "$hg_root_dir" 1332 | __bobthefish_prompt_hg $hg_root_dir $real_pwd 1333 | case "$fossil_root_dir" 1334 | __bobthefish_prompt_fossil $fossil_root_dir $real_pwd 1335 | end 1336 | 1337 | __bobthefish_finish_segments 1338 | end 1339 | -------------------------------------------------------------------------------- /functions/__bobthefish_colors.fish: -------------------------------------------------------------------------------- 1 | function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthefish' 2 | switch "$color_scheme" 3 | case 'user' 4 | __bobthefish_user_color_scheme_deprecated 5 | return 6 | 7 | case 'terminal' 'terminal-dark*' 8 | set -l colorfg black 9 | [ "$color_scheme" = 'terminal-dark-white' ]; and set colorfg white 10 | set -x color_initial_segment_exit white red --bold 11 | set -x color_initial_segment_private white black 12 | set -x color_initial_segment_su white green --bold 13 | set -x color_initial_segment_jobs white blue --bold 14 | 15 | set -x color_path black white 16 | set -x color_path_basename black white --bold 17 | set -x color_path_nowrite magenta $colorfg 18 | set -x color_path_nowrite_basename magenta $colorfg --bold 19 | 20 | set -x color_repo green $colorfg 21 | set -x color_repo_work_tree black $colorfg --bold 22 | set -x color_repo_dirty brred $colorfg 23 | set -x color_repo_staged yellow $colorfg 24 | 25 | set -x color_vi_mode_default brblue $colorfg --bold 26 | set -x color_vi_mode_insert brgreen $colorfg --bold 27 | set -x color_vi_mode_visual bryellow $colorfg --bold 28 | 29 | set -x color_vagrant brcyan $colorfg 30 | set -x color_k8s magenta white --bold 31 | set -x color_aws_vault blue $colorfg --bold 32 | set -x color_aws_vault_expired blue red --bold 33 | set -x color_username white black --bold 34 | set -x color_hostname white black 35 | set -x color_screen brgreen $colorfg --bold 36 | set -x color_rvm brmagenta $colorfg --bold 37 | set -x color_node brgreen $colorfg --bold 38 | set -x color_virtualfish brblue $colorfg --bold 39 | set -x color_virtualgo brblue $colorfg --bold 40 | set -x color_desk brblue $colorfg --bold 41 | set -x color_nix brblue $colorfg --bold 42 | 43 | case 'terminal-light*' 44 | set -l colorfg white 45 | [ "$color_scheme" = 'terminal-light-black' ]; and set colorfg black 46 | set -x color_initial_segment_exit black red --bold 47 | set -x color_initial_segment_private black white 48 | set -x color_initial_segment_su black green --bold 49 | set -x color_initial_segment_jobs black blue --bold 50 | 51 | set -x color_path white black 52 | set -x color_path_basename white black --bold 53 | set -x color_path_nowrite magenta $colorfg 54 | set -x color_path_nowrite_basename magenta $colorfg --bold 55 | 56 | set -x color_repo green $colorfg 57 | set -x color_repo_work_tree white $colorfg --bold 58 | set -x color_repo_dirty brred $colorfg 59 | set -x color_repo_staged yellow $colorfg 60 | 61 | set -x color_vi_mode_default brblue $colorfg --bold 62 | set -x color_vi_mode_insert brgreen $colorfg --bold 63 | set -x color_vi_mode_visual bryellow $colorfg --bold 64 | 65 | set -x color_vagrant brcyan $colorfg 66 | set -x color_k8s magenta white --bold 67 | set -x color_aws_vault blue $colorfg --bold 68 | set -x color_aws_vault_expired blue red --bold 69 | set -x color_username black white --bold 70 | set -x color_hostname black white 71 | set -x color_screen brgreen $colorfg --bold 72 | set -x color_rvm brmagenta $colorfg --bold 73 | set -x color_node brgreen $colorfg --bold 74 | set -x color_virtualfish brblue $colorfg --bold 75 | set -x color_virtualgo brblue $colorfg --bold 76 | set -x color_desk brblue $colorfg --bold 77 | set -x color_nix brblue $colorfg --bold 78 | 79 | case 'terminal2' 'terminal2-dark*' 80 | set -l colorfg black 81 | [ "$color_scheme" = 'terminal2-dark-white' ]; and set colorfg white 82 | set -x color_initial_segment_exit grey red --bold 83 | set -x color_initial_segment_private grey black 84 | set -x color_initial_segment_su grey green --bold 85 | set -x color_initial_segment_jobs grey blue --bold 86 | 87 | set -x color_path brgrey white 88 | set -x color_path_basename brgrey white --bold 89 | set -x color_path_nowrite magenta $colorfg 90 | set -x color_path_nowrite_basename magenta $colorfg --bold 91 | 92 | set -x color_repo green $colorfg 93 | set -x color_repo_work_tree brgrey $colorfg --bold 94 | set -x color_repo_dirty brred $colorfg 95 | set -x color_repo_staged yellow $colorfg 96 | 97 | set -x color_vi_mode_default brblue $colorfg --bold 98 | set -x color_vi_mode_insert brgreen $colorfg --bold 99 | set -x color_vi_mode_visual bryellow $colorfg --bold 100 | 101 | set -x color_vagrant brcyan $colorfg 102 | set -x color_k8s magenta white --bold 103 | set -x color_aws_vault blue $colorfg --bold 104 | set -x color_aws_vault_expired blue red --bold 105 | set -x color_username brgrey white --bold 106 | set -x color_hostname brgrey white 107 | set -x color_screen brgreen $colorfg --bold 108 | set -x color_rvm brmagenta $colorfg --bold 109 | set -x color_node brgreen $colorfg --bold 110 | set -x color_virtualfish brblue $colorfg --bold 111 | set -x color_virtualgo brblue $colorfg --bold 112 | set -x color_desk brblue $colorfg --bold 113 | set -x color_nix brblue $colorfg --bold 114 | 115 | case 'terminal2-light*' 116 | set -l colorfg white 117 | [ "$color_scheme" = 'terminal2-light-black' ]; and set colorfg black 118 | set -x color_initial_segment_exit brgrey red --bold 119 | set -x color_initial_segment_private brgrey black 120 | set -x color_initial_segment_su brgrey green --bold 121 | set -x color_initial_segment_jobs brgrey blue --bold 122 | 123 | set -x color_path grey black 124 | set -x color_path_basename grey black --bold 125 | set -x color_path_nowrite magenta $colorfg 126 | set -x color_path_nowrite_basename magenta $colorfg --bold 127 | 128 | set -x color_repo green $colorfg 129 | set -x color_repo_work_tree grey $colorfg --bold 130 | set -x color_repo_dirty brred $colorfg 131 | set -x color_repo_staged yellow $colorfg 132 | 133 | set -x color_vi_mode_default brblue $colorfg --bold 134 | set -x color_vi_mode_insert brgreen $colorfg --bold 135 | set -x color_vi_mode_visual bryellow $colorfg --bold 136 | 137 | set -x color_vagrant brcyan $colorfg 138 | set -x color_k8s magenta white --bold 139 | set -x color_aws_vault blue $colorfg --bold 140 | set -x color_aws_vault_expired blue red --bold 141 | set -x color_username grey black --bold 142 | set -x color_hostname grey black 143 | set -x color_screen brgreen $colorfg --bold 144 | set -x color_rvm brmagenta $colorfg --bold 145 | set -x color_node brgreen $colorfg --bold 146 | set -x color_virtualfish brblue $colorfg --bold 147 | set -x color_virtualgo brblue $colorfg --bold 148 | set -x color_desk brblue $colorfg --bold 149 | set -x color_nix brblue $colorfg --bold 150 | 151 | case 'zenburn' 152 | set -l grey 333333 # a bit darker than normal zenburn grey 153 | set -l red CC9393 154 | set -l green 7F9F7F 155 | set -l yellow E3CEAB 156 | set -l orange DFAF8F 157 | set -l blue 8CD0D3 158 | set -l white DCDCCC 159 | 160 | set -x color_initial_segment_exit $white $red --bold 161 | set -x color_initial_segment_private $white $grey 162 | set -x color_initial_segment_su $white $green --bold 163 | set -x color_initial_segment_jobs $white $blue --bold 164 | 165 | set -x color_path $grey $white 166 | set -x color_path_basename $grey $white --bold 167 | set -x color_path_nowrite $grey $red 168 | set -x color_path_nowrite_basename $grey $red --bold 169 | 170 | set -x color_repo $green $grey 171 | set -x color_repo_work_tree $grey $grey --bold 172 | set -x color_repo_dirty $red $grey 173 | set -x color_repo_staged $yellow $grey 174 | 175 | set -x color_vi_mode_default $grey $yellow --bold 176 | set -x color_vi_mode_insert $green $white --bold 177 | set -x color_vi_mode_visual $yellow $grey --bold 178 | 179 | set -x color_vagrant $blue $green --bold 180 | set -x color_k8s $green $white --bold 181 | set -x color_aws_vault $blue $grey --bold 182 | set -x color_aws_vault_expired $blue $red --bold 183 | set -x color_username $grey $blue --bold 184 | set -x color_hostname $grey $blue 185 | set -x color_screen $green $grey --bold 186 | set -x color_rvm $red $grey --bold 187 | set -x color_node $green $white --bold 188 | set -x color_virtualfish $blue $grey --bold 189 | set -x color_virtualgo $blue $grey --bold 190 | set -x color_desk $blue $grey --bold 191 | set -x color_nix $blue $grey --bold 192 | 193 | case 'base16-light' 194 | set -l base00 181818 195 | set -l base01 282828 196 | set -l base02 383838 197 | set -l base03 585858 198 | set -l base04 b8b8b8 199 | set -l base05 d8d8d8 200 | set -l base06 e8e8e8 201 | set -l base07 f8f8f8 202 | set -l base08 ab4642 # red 203 | set -l base09 dc9656 # orange 204 | set -l base0A f7ca88 # yellow 205 | set -l base0B a1b56c # green 206 | set -l base0C 86c1b9 # cyan 207 | set -l base0D 7cafc2 # blue 208 | set -l base0E ba8baf # violet 209 | set -l base0F a16946 # brown 210 | 211 | set -l colorfg $base00 212 | 213 | set -x color_initial_segment_exit $base02 $base08 --bold 214 | set -x color_initial_segment_private $base02 $base06 215 | set -x color_initial_segment_su $base02 $base0B --bold 216 | set -x color_initial_segment_jobs $base02 $base0D --bold 217 | 218 | set -x color_path $base06 $base02 219 | set -x color_path_basename $base06 $base01 --bold 220 | set -x color_path_nowrite $base06 $base08 221 | set -x color_path_nowrite_basename $base06 $base08 --bold 222 | 223 | set -x color_repo $base0B $colorfg 224 | set -x color_repo_work_tree $base06 $colorfg --bold 225 | set -x color_repo_dirty $base08 $colorfg 226 | set -x color_repo_staged $base09 $colorfg 227 | 228 | set -x color_vi_mode_default $base04 $colorfg --bold 229 | set -x color_vi_mode_insert $base0B $colorfg --bold 230 | set -x color_vi_mode_visual $base09 $colorfg --bold 231 | 232 | set -x color_vagrant $base0C $colorfg --bold 233 | set -x color_k8s $base06 $colorfg --bold 234 | set -x color_aws_vault $base0D $colorfg --bold 235 | set -x color_aws_vault_expired $base0D $base08 --bold 236 | set -x color_username $base02 $base0D --bold 237 | set -x color_hostname $base02 $base0D 238 | set -x color_screen $base06 $colorfg --bold 239 | set -x color_rvm $base08 $colorfg --bold 240 | set -x color_node $base0B $colorfg --bold 241 | set -x color_virtualfish $base0D $colorfg --bold 242 | set -x color_virtualgo $base0D $colorfg --bold 243 | set -x color_desk $base0D $colorfg --bold 244 | set -x color_nix $base0D $colorfg --bold 245 | 246 | case 'base16' 'base16-dark' 247 | set -l base00 181818 248 | set -l base01 282828 249 | set -l base02 383838 250 | set -l base03 585858 251 | set -l base04 b8b8b8 252 | set -l base05 d8d8d8 253 | set -l base06 e8e8e8 254 | set -l base07 f8f8f8 255 | set -l base08 ab4642 # red 256 | set -l base09 dc9656 # orange 257 | set -l base0A f7ca88 # yellow 258 | set -l base0B a1b56c # green 259 | set -l base0C 86c1b9 # cyan 260 | set -l base0D 7cafc2 # blue 261 | set -l base0E ba8baf # violet 262 | set -l base0F a16946 # brown 263 | 264 | set -l colorfg $base07 265 | 266 | set -x color_initial_segment_exit $base05 $base08 --bold 267 | set -x color_initial_segment_private $base05 $base02 268 | set -x color_initial_segment_su $base05 $base0B --bold 269 | set -x color_initial_segment_jobs $base05 $base0D --bold 270 | 271 | set -x color_path $base02 $base05 272 | set -x color_path_basename $base02 $base06 --bold 273 | set -x color_path_nowrite $base02 $base08 274 | set -x color_path_nowrite_basename $base02 $base08 --bold 275 | 276 | set -x color_repo $base0B $colorfg 277 | set -x color_repo_work_tree $base02 $colorfg --bold 278 | set -x color_repo_dirty $base08 $colorfg 279 | set -x color_repo_staged $base09 $colorfg 280 | 281 | set -x color_vi_mode_default $base03 $colorfg --bold 282 | set -x color_vi_mode_insert $base0B $colorfg --bold 283 | set -x color_vi_mode_visual $base09 $colorfg --bold 284 | 285 | set -x color_vagrant $base0C $colorfg --bold 286 | set -x color_k8s $base0B $colorfg --bold 287 | set -x color_aws_vault $base0D $base0A --bold 288 | set -x color_aws_vault_expired $base0D $base08 --bold 289 | set -x color_username $base02 $base0D --bold 290 | set -x color_hostname $base02 $base0D 291 | set -x color_screen $base0B $colorfg --bold 292 | set -x color_rvm $base08 $colorfg --bold 293 | set -x color_node $base0B $colorfg --bold 294 | set -x color_virtualfish $base0D $colorfg --bold 295 | set -x color_virtualgo $base0D $colorfg --bold 296 | set -x color_desk $base0D $colorfg --bold 297 | set -x color_nix $base0D $colorfg --bold 298 | 299 | case 'solarized-light' 300 | set -l base03 002b36 301 | set -l base02 073642 302 | set -l base01 586e75 303 | set -l base00 657b83 304 | set -l base0 839496 305 | set -l base1 93a1a1 306 | set -l base2 eee8d5 307 | set -l base3 fdf6e3 308 | set -l yellow b58900 309 | set -l orange cb4b16 310 | set -l red dc322f 311 | set -l magenta d33682 312 | set -l violet 6c71c4 313 | set -l blue 268bd2 314 | set -l cyan 2aa198 315 | set -l green 859900 316 | 317 | set colorfg $base03 318 | 319 | set -x color_initial_segment_exit $base02 $red --bold 320 | set -x color_initial_segment_private $base02 $base2 321 | set -x color_initial_segment_su $base02 $green --bold 322 | set -x color_initial_segment_jobs $base02 $blue --bold 323 | 324 | set -x color_path $base2 $base00 325 | set -x color_path_basename $base2 $base01 --bold 326 | set -x color_path_nowrite $base2 $orange 327 | set -x color_path_nowrite_basename $base2 $orange --bold 328 | 329 | set -x color_repo $green $colorfg 330 | set -x color_repo_work_tree $base2 $colorfg --bold 331 | set -x color_repo_dirty $red $colorfg 332 | set -x color_repo_staged $yellow $colorfg 333 | 334 | set -x color_vi_mode_default $blue $colorfg --bold 335 | set -x color_vi_mode_insert $green $colorfg --bold 336 | set -x color_vi_mode_visual $yellow $colorfg --bold 337 | 338 | set -x color_vagrant $violet $colorfg --bold 339 | set -x color_k8s $green $colorfg --bold 340 | set -x color_aws_vault $violet $base3 --bold 341 | set -x color_aws_vault_expired $violet $orange --bold 342 | set -x color_username $base2 $blue --bold 343 | set -x color_hostname $base2 $blue 344 | set -x color_screen $green $colorfg --bold 345 | set -x color_rvm $red $colorfg --bold 346 | set -x color_node $green $colorfg --bold 347 | set -x color_virtualfish $cyan $colorfg --bold 348 | set -x color_virtualgo $cyan $colorfg --bold 349 | set -x color_desk $cyan $colorfg --bold 350 | set -x color_nix $cyan $colorfg --bold 351 | 352 | case 'solarized' 'solarized-dark' 353 | set -l base03 002b36 354 | set -l base02 073642 355 | set -l base01 586e75 356 | set -l base00 657b83 357 | set -l base0 839496 358 | set -l base1 93a1a1 359 | set -l base2 eee8d5 360 | set -l base3 fdf6e3 361 | set -l yellow b58900 362 | set -l orange cb4b16 363 | set -l red dc322f 364 | set -l magenta d33682 365 | set -l violet 6c71c4 366 | set -l blue 268bd2 367 | set -l cyan 2aa198 368 | set -l green 859900 369 | 370 | set colorfg $base3 371 | 372 | set -x color_initial_segment_exit $base2 $red --bold 373 | set -x color_initial_segment_private $base2 $base02 374 | set -x color_initial_segment_su $base2 $green --bold 375 | set -x color_initial_segment_jobs $base2 $blue --bold 376 | 377 | set -x color_path $base02 $base0 378 | set -x color_path_basename $base02 $base1 --bold 379 | set -x color_path_nowrite $base02 $orange 380 | set -x color_path_nowrite_basename $base02 $orange --bold 381 | 382 | set -x color_repo $green $colorfg 383 | set -x color_repo_work_tree $base02 $colorfg --bold 384 | set -x color_repo_dirty $red $colorfg 385 | set -x color_repo_staged $yellow $colorfg 386 | 387 | set -x color_vi_mode_default $blue $colorfg --bold 388 | set -x color_vi_mode_insert $green $colorfg --bold 389 | set -x color_vi_mode_visual $yellow $colorfg --bold 390 | 391 | set -x color_vagrant $violet $colorfg --bold 392 | set -x color_k8s $green $colorfg --bold 393 | set -x color_aws_vault $violet $base3 --bold 394 | set -x color_aws_vault_expired $violet $orange --bold 395 | set -x color_username $base02 $blue --bold 396 | set -x color_hostname $base02 $blue 397 | set -x color_screen $green $colorfg --bold 398 | set -x color_rvm $red $colorfg --bold 399 | set -x color_node $green $colorfg --bold 400 | set -x color_virtualfish $cyan $colorfg --bold 401 | set -x color_virtualgo $cyan $colorfg --bold 402 | set -x color_desk $cyan $colorfg --bold 403 | set -x color_nix $cyan $colorfg --bold 404 | 405 | case 'light' 406 | # light medium dark 407 | # ------ ------ ------ 408 | set -l red cc9999 ce000f 660000 409 | set -l green addc10 189303 0c4801 410 | set -l blue 48b4fb 005faf 255e87 411 | set -l orange f6b117 unused 3a2a03 412 | set -l brown bf5e00 803f00 4d2600 413 | set -l grey cccccc 999999 333333 414 | set -l white ffffff 415 | set -l black 000000 416 | set -l ruby_red af0000 417 | 418 | set -x color_initial_segment_exit $grey[3] $red[2] --bold 419 | set -x color_initial_segment_private $grey[3] $grey[1] 420 | set -x color_initial_segment_su $grey[3] $green[2] --bold 421 | set -x color_initial_segment_jobs $grey[3] $blue[3] --bold 422 | 423 | set -x color_path $grey[1] $grey[2] 424 | set -x color_path_basename $grey[1] $grey[3] --bold 425 | set -x color_path_nowrite $red[1] $red[3] 426 | set -x color_path_nowrite_basename $red[1] $red[3] --bold 427 | 428 | set -x color_repo $green[1] $green[3] 429 | set -x color_repo_work_tree $grey[1] $white --bold 430 | set -x color_repo_dirty $red[2] $white 431 | set -x color_repo_staged $orange[1] $orange[3] 432 | 433 | set -x color_vi_mode_default $grey[2] $grey[3] --bold 434 | set -x color_vi_mode_insert $green[2] $grey[3] --bold 435 | set -x color_vi_mode_visual $orange[1] $orange[3] --bold 436 | 437 | set -x color_vagrant $blue[1] $white --bold 438 | set -x color_k8s $green[1] $colorfg --bold 439 | set -x color_aws_vault $blue[3] $orange[1] --bold 440 | set -x color_aws_vault_expired $blue[3] $red[3] --bold 441 | set -x color_username $grey[1] $blue[3] --bold 442 | set -x color_hostname $grey[1] $blue[3] 443 | set -x color_screen $green[1] $colorfg --bold 444 | set -x color_rvm $ruby_red $grey[1] --bold 445 | set -x color_node $green $grey[1] --bold 446 | set -x color_virtualfish $blue[2] $grey[1] --bold 447 | set -x color_virtualgo $blue[2] $grey[1] --bold 448 | set -x color_desk $blue[2] $grey[1] --bold 449 | set -x color_nix $blue[2] $grey[1] --bold 450 | 451 | case 'gruvbox' 452 | # light medium dark darkest 453 | # ------ ------ ------ ------- 454 | set -l red fb4934 cc241d 455 | set -l green b8bb26 98971a 456 | set -l yellow fabd2f d79921 457 | set -l aqua 8ec07c 689d6a 458 | set -l blue 83a598 458588 459 | set -l grey cccccc 999999 333333 460 | set -l fg fbf1c7 ebdbb2 d5c4a1 a89984 461 | set -l bg 504945 282828 462 | 463 | set -x color_initial_segment_exit $fg[1] $red[2] --bold 464 | set -x color_initial_segment_private $fg[1] $bg[1] 465 | set -x color_initial_segment_su $fg[1] $green[2] --bold 466 | set -x color_initial_segment_jobs $fg[1] $aqua[2] --bold 467 | 468 | set -x color_path $bg[1] $fg[2] 469 | set -x color_path_basename $bg[1] $fg[2] --bold 470 | set -x color_path_nowrite $red[1] $fg[2] 471 | set -x color_path_nowrite_basename $red[1] $fg[2] --bold 472 | 473 | set -x color_repo $green[2] $bg[1] 474 | set -x color_repo_work_tree $bg[1] $fg[2] --bold 475 | set -x color_repo_dirty $red[2] $fg[2] 476 | set -x color_repo_staged $yellow[1] $bg[1] 477 | 478 | set -x color_vi_mode_default $fg[4] $bg[2] --bold 479 | set -x color_vi_mode_insert $blue[1] $bg[2] --bold 480 | set -x color_vi_mode_visual $yellow[1] $bg[2] --bold 481 | 482 | set -x color_vagrant $blue[2] $fg[2] --bold 483 | set -x color_k8s $green[2] $fg[2] --bold 484 | set -x color_aws_vault $blue[2] $yellow[1] --bold 485 | set -x color_aws_vault_expired $blue[2] $red[1] --bold 486 | set -x color_username $fg[3] $blue[2] --bold 487 | set -x color_hostname $fg[3] $blue[2] 488 | set -x color_screen $green[1] $fg[2] --bold 489 | set -x color_rvm $red[2] $fg[2] --bold 490 | set -x color_node $green[1] $fg[2] --bold 491 | set -x color_virtualfish $blue[2] $fg[2] --bold 492 | set -x color_virtualgo $blue[2] $fg[2] --bold 493 | set -x color_desk $blue[2] $fg[2] --bold 494 | set -x color_nix $blue[2] $fg[2] --bold 495 | 496 | case 'gruvbox-light' 497 | # light medium dark darkest 498 | # ------ ------ ------ ------- 499 | set -l red 9d0006 cc241d 500 | set -l green 79740e 98971a 501 | set -l yellow b57614 d79921 502 | set -l aqua 427b58 689d6a 503 | set -l blue 076678 458588 504 | set -l grey a89984 928374 505 | set -l orange af3a03 d65d0e 506 | set -l fg 282828 3c3836 504945 7c6f64 507 | set -l bg d5c4a1 fbf1c7 508 | 509 | set -x color_initial_segment_exit $red[1] $bg[2] --bold 510 | set -x color_initial_segment_su $fg[1] $green[2] --bold 511 | set -x color_initial_segment_jobs $fg[1] $aqua[2] --bold 512 | 513 | set -x color_path $bg[1] $fg[2] 514 | set -x color_path_basename $bg[1] $fg[2] --bold 515 | set -x color_path_nowrite $red[1] $bg[2] 516 | set -x color_path_nowrite_basename $red[1] $bg[2] --bold 517 | 518 | set -x color_repo $green[2] $fg[1] 519 | set -x color_repo_work_tree $bg[1] $fg[2] --bold 520 | set -x color_repo_dirty $orange[2] $bg[2] 521 | set -x color_repo_staged $yellow[1] $bg[1] 522 | 523 | set -x color_vi_mode_default $fg[4] $bg[2] --bold 524 | set -x color_vi_mode_insert $blue[1] $bg[2] --bold 525 | set -x color_vi_mode_visual $yellow[1] $bg[2] --bold 526 | 527 | set -x color_vagrant $blue[2] $fg[2] --bold 528 | set -x color_k8s $green[2] $fg[2] --bold 529 | set -x color_username $fg[3] $blue[2] --bold 530 | set -x color_hostname $fg[3] $blue[2] 531 | set -x color_screen $green[2] $fg[2] --bold 532 | set -x color_rvm $red[2] $bg[2] --bold 533 | set -x color_nvm $green[1] $fg[2] --bold 534 | set -x color_virtualfish $blue[2] $fg[2] --bold 535 | set -x color_virtualgo $blue[2] $fg[2] --bold 536 | set -x color_desk $blue[2] $fg[2] --bold 537 | set -x color_nix $blue[2] $fg[2] --bold 538 | 539 | case 'dracula' # https://draculatheme.com 540 | set -l bg 282a36 541 | set -l current_line 44475a 542 | set -l selection 44475a 543 | set -l fg f8f8f2 544 | set -l comment 6272a4 545 | set -l cyan 8be9fd 546 | set -l green 50fa7b 547 | set -l orange ffb86c 548 | set -l pink ff79c6 549 | set -l purple bd93f9 550 | set -l red ff5555 551 | set -l yellow f1fa8c 552 | 553 | set -x color_initial_segment_exit $fg $red --bold 554 | set -x color_initial_segment_private $fg $selection 555 | set -x color_initial_segment_su $fg $purple --bold 556 | set -x color_initial_segment_jobs $fg $comment --bold 557 | 558 | set -x color_path $selection $fg 559 | set -x color_path_basename $selection $fg --bold 560 | set -x color_path_nowrite $selection $red 561 | set -x color_path_nowrite_basename $selection $red --bold 562 | 563 | set -x color_repo $green $bg 564 | set -x color_repo_work_tree $selection $fg --bold 565 | set -x color_repo_dirty $red $bg 566 | set -x color_repo_staged $yellow $bg 567 | 568 | set -x color_vi_mode_default $bg $yellow --bold 569 | set -x color_vi_mode_insert $green $bg --bold 570 | set -x color_vi_mode_visual $orange $bg --bold 571 | 572 | set -x color_vagrant $pink $bg --bold 573 | set -x color_k8s $purple $bg --bold 574 | set -x color_aws_vault $comment $yellow --bold 575 | set -x color_aws_vault_expired $comment $red --bold 576 | set -x color_username $selection $cyan --bold 577 | set -x color_hostname $selection $cyan 578 | set -x color_screen $green $bg --bold 579 | set -x color_rvm $red $bg --bold 580 | set -x color_node $green $bg --bold 581 | set -x color_virtualfish $comment $bg --bold 582 | set -x color_virtualgo $cyan $bg --bold 583 | set -x color_desk $comment $bg --bold 584 | set -x color_nix $cyan $bg --bold 585 | 586 | case 'nord' 587 | set -l base00 2E3440 588 | set -l base01 3B4252 589 | set -l base02 434C5E 590 | set -l base03 4C566A 591 | set -l base04 D8DEE9 592 | set -l base05 E5E9F0 593 | set -l base06 ECEFF4 594 | set -l base07 8FBCBB 595 | set -l base08 88C0D0 596 | set -l base09 81A1C1 597 | set -l base0A 5E81AC 598 | set -l base0B BF616A 599 | set -l base0C D08770 600 | set -l base0D EBCB8B 601 | set -l base0E A3BE8C 602 | set -l base0F B48EAD 603 | 604 | set -l colorfg $base00 605 | 606 | set -x color_initial_segment_exit $base05 $base0B --bold 607 | set -x color_initial_segment_private $base05 $base02 608 | set -x color_initial_segment_su $base05 $base0E --bold 609 | set -x color_initial_segment_jobs $base05 $base0C --bold 610 | 611 | set -x color_path $base02 $base05 612 | set -x color_path_basename $base02 $base06 --bold 613 | set -x color_path_nowrite $base02 $base08 614 | set -x color_path_nowrite_basename $base02 $base08 --bold 615 | 616 | set -x color_repo $base0E $colorfg 617 | set -x color_repo_work_tree $base02 $colorfg --bold 618 | set -x color_repo_dirty $base0B $colorfg 619 | set -x color_repo_staged $base0D $colorfg 620 | 621 | set -x color_vi_mode_default $base08 $colorfg --bold 622 | set -x color_vi_mode_insert $base06 $colorfg --bold 623 | set -x color_vi_mode_visual $base07 $colorfg --bold 624 | 625 | set -x color_vagrant $base02 $colorfg --bold 626 | set -x color_k8s $base02 $colorfg --bold 627 | set -x color_aws_vault $base0A $base0D --bold 628 | set -x color_aws_vault_expired $base0A $base0B --bold 629 | set -x color_username $base02 $base0D --bold 630 | set -x color_hostname $base02 $base0D 631 | set -x color_screen $base02 $colorfg --bold 632 | set -x color_rvm $base09 $colorfg --bold 633 | set -x color_node $base09 $colorfg --bold 634 | set -x color_virtualfish $base09 $colorfg --bold 635 | set -x color_virtualgo $base09 $colorfg --bold 636 | set -x color_desk $base09 $colorfg --bold 637 | 638 | case 'catppuccin-latte' 639 | set -l rosewater dc8a78 640 | set -l flamingo dd7878 641 | set -l pink ea76cb 642 | set -l mauve 8839ef 643 | set -l red d20f39 644 | set -l maroon e64553 645 | set -l peach fe640b 646 | set -l yellow df8e1d 647 | set -l green 40a02b 648 | set -l teal 179299 649 | set -l sky 04a5e5 650 | set -l sapphire 209fb5 651 | set -l blue 1e66f5 652 | set -l lavender 7287fd 653 | set -l text 4c4f69 654 | set -l subtext1 5c5f77 655 | set -l subtext0 6c6f85 656 | set -l overlay2 7c7f93 657 | set -l overlay1 8c8fa1 658 | set -l overlay0 9ca0b0 659 | set -l surface2 acb0be 660 | set -l surface1 bcc0cc 661 | set -l surface0 ccd0da 662 | set -l base eff1f5 663 | set -l mantle e6e9ef 664 | set -l crust dce0e8 665 | 666 | set -x color_initial_segment_exit $surface2 $red --bold 667 | set -x color_initial_segment_private $surface2 $flamingo 668 | set -x color_initial_segment_su $surface2 $green --bold 669 | set -x color_initial_segment_jobs $surface2 $peach --bold 670 | 671 | set -x color_path $surface0 $text 672 | set -x color_path_basename $surface0 $text --bold 673 | set -x color_path_nowrite $surface0 $mauve 674 | set -x color_path_nowrite_basename $surface0 $mauve --bold 675 | 676 | set -x color_repo $green $mantle 677 | set -x color_repo_work_tree $surface2 $mantle --bold 678 | set -x color_repo_dirty $red $mantle 679 | set -x color_repo_staged $yellow $mantle 680 | 681 | set -x color_vi_mode_default $sky $mantle --bold 682 | set -x color_vi_mode_insert $green $mantle --bold 683 | set -x color_vi_mode_visual $mauve $mantle --bold 684 | 685 | set -x color_vagrant $surface2 $text --bold 686 | set -x color_k8s $surface2 $text --bold 687 | set -x color_aws_vault $yellow $mantle --bold 688 | set -x color_aws_vault_expired $red $mantle --bold 689 | set -x color_username $surface2 $yellow --bold 690 | set -x color_hostname $surface2 $yellow 691 | set -x color_screen $green $mantle --bold 692 | set -x color_rvm $red $mantle --bold 693 | set -x color_node $green $mantle --bold 694 | set -x color_virtualfish $peach $mantle --bold 695 | set -x color_virtualgo $sky $mantle --bold 696 | set -x color_desk $peach $mantle --bold 697 | set -x color_nix $sky $mantle --bold 698 | 699 | case 'catppuccin-frappe' 700 | set -l rosewater f2d5cf 701 | set -l flamingo eebebe 702 | set -l pink f4b8e4 703 | set -l mauve ca9ee6 704 | set -l red e78284 705 | set -l maroon ea999c 706 | set -l peach ef9f76 707 | set -l yellow e5c890 708 | set -l green a6d189 709 | set -l teal 81c8be 710 | set -l sky 99d1db 711 | set -l sapphire 85c1dc 712 | set -l blue 8caaee 713 | set -l lavender babbf1 714 | set -l text c6d0f5 715 | set -l subtext1 b5bfe2 716 | set -l subtext0 a5adce 717 | set -l overlay2 949cbb 718 | set -l overlay1 838ba7 719 | set -l overlay0 737994 720 | set -l surface2 626880 721 | set -l surface1 51576d 722 | set -l surface0 414559 723 | set -l base 303446 724 | set -l mantle 292c3c 725 | set -l crust 232634 726 | 727 | set -x color_initial_segment_exit $surface2 $red --bold 728 | set -x color_initial_segment_private $surface2 $flamingo 729 | set -x color_initial_segment_su $surface2 $green --bold 730 | set -x color_initial_segment_jobs $surface2 $peach --bold 731 | 732 | set -x color_path $surface0 $text 733 | set -x color_path_basename $surface0 $text --bold 734 | set -x color_path_nowrite $surface0 $mauve 735 | set -x color_path_nowrite_basename $surface0 $mauve --bold 736 | 737 | set -x color_repo $green $mantle 738 | set -x color_repo_work_tree $surface2 $mantle --bold 739 | set -x color_repo_dirty $red $mantle 740 | set -x color_repo_staged $yellow $mantle 741 | 742 | set -x color_vi_mode_default $sky $mantle --bold 743 | set -x color_vi_mode_insert $green $mantle --bold 744 | set -x color_vi_mode_visual $mauve $mantle --bold 745 | 746 | set -x color_vagrant $surface2 $text --bold 747 | set -x color_k8s $surface2 $text --bold 748 | set -x color_aws_vault $yellow $mantle --bold 749 | set -x color_aws_vault_expired $red $mantle --bold 750 | set -x color_username $surface2 $yellow --bold 751 | set -x color_hostname $surface2 $yellow 752 | set -x color_screen $green $mantle --bold 753 | set -x color_rvm $red $mantle --bold 754 | set -x color_node $green $mantle --bold 755 | set -x color_virtualfish $peach $mantle --bold 756 | set -x color_virtualgo $sky $mantle --bold 757 | set -x color_desk $peach $mantle --bold 758 | set -x color_nix $sky $mantle --bold 759 | 760 | case 'catppuccin-macchiato' 761 | set -l rosewater f4dbd6 762 | set -l flamingo f0c6c6 763 | set -l pink f5bde6 764 | set -l mauve c6a0f6 765 | set -l red ed8796 766 | set -l maroon ee99a0 767 | set -l peach f5a97f 768 | set -l yellow eed49f 769 | set -l green a6da95 770 | set -l teal 8bd5ca 771 | set -l sky 91d7e3 772 | set -l sapphire 7dc4e4 773 | set -l blue 8aadf4 774 | set -l lavender b7bdf8 775 | set -l text cad3f5 776 | set -l subtext1 b8c0e0 777 | set -l subtext0 a5adcb 778 | set -l overlay2 939ab7 779 | set -l overlay1 8087a2 780 | set -l overlay0 6e738d 781 | set -l surface2 5b6078 782 | set -l surface1 494d64 783 | set -l surface0 363a4f 784 | set -l base 24273a 785 | set -l mantle 1e2030 786 | set -l crust 181926 787 | 788 | set -x color_initial_segment_exit $surface2 $red --bold 789 | set -x color_initial_segment_private $surface2 $flamingo 790 | set -x color_initial_segment_su $surface2 $green --bold 791 | set -x color_initial_segment_jobs $surface2 $peach --bold 792 | 793 | set -x color_path $surface0 $text 794 | set -x color_path_basename $surface0 $text --bold 795 | set -x color_path_nowrite $surface0 $mauve 796 | set -x color_path_nowrite_basename $surface0 $mauve --bold 797 | 798 | set -x color_repo $green $mantle 799 | set -x color_repo_work_tree $surface2 $mantle --bold 800 | set -x color_repo_dirty $red $mantle 801 | set -x color_repo_staged $yellow $mantle 802 | 803 | set -x color_vi_mode_default $sky $mantle --bold 804 | set -x color_vi_mode_insert $green $mantle --bold 805 | set -x color_vi_mode_visual $mauve $mantle --bold 806 | 807 | set -x color_vagrant $surface2 $text --bold 808 | set -x color_k8s $surface2 $text --bold 809 | set -x color_aws_vault $yellow $mantle --bold 810 | set -x color_aws_vault_expired $red $mantle --bold 811 | set -x color_username $surface2 $yellow --bold 812 | set -x color_hostname $surface2 $yellow 813 | set -x color_screen $green $mantle --bold 814 | set -x color_rvm $red $mantle --bold 815 | set -x color_node $green $mantle --bold 816 | set -x color_virtualfish $peach $mantle --bold 817 | set -x color_virtualgo $sky $mantle --bold 818 | set -x color_desk $peach $mantle --bold 819 | set -x color_nix $sky $mantle --bold 820 | 821 | case 'catppuccin-mocha' 822 | set -l rosewater f5e0dc 823 | set -l flamingo f2cdcd 824 | set -l pink f5c2e7 825 | set -l mauve cba6f7 826 | set -l red f38ba8 827 | set -l maroon eba0ac 828 | set -l peach fab387 829 | set -l yellow f9e2af 830 | set -l green a6e3a1 831 | set -l teal 94e2d5 832 | set -l sky 89dceb 833 | set -l sapphire 74c7ec 834 | set -l blue 89b4fa 835 | set -l lavender b4befe 836 | set -l text cdd6f4 837 | set -l subtext1 bac2de 838 | set -l subtext0 a6adc8 839 | set -l overlay2 9399b2 840 | set -l overlay1 7f849c 841 | set -l overlay0 6c7086 842 | set -l surface2 585b70 843 | set -l surface1 45475a 844 | set -l surface0 313244 845 | set -l base 1e1e2e 846 | set -l mantle 181825 847 | set -l crust 11111b 848 | 849 | set -x color_initial_segment_exit $surface2 $red --bold 850 | set -x color_initial_segment_private $surface2 $flamingo 851 | set -x color_initial_segment_su $surface2 $green --bold 852 | set -x color_initial_segment_jobs $surface2 $peach --bold 853 | 854 | set -x color_path $surface0 $text 855 | set -x color_path_basename $surface0 $text --bold 856 | set -x color_path_nowrite $surface0 $mauve 857 | set -x color_path_nowrite_basename $surface0 $mauve --bold 858 | 859 | set -x color_repo $green $mantle 860 | set -x color_repo_work_tree $surface2 $mantle --bold 861 | set -x color_repo_dirty $red $mantle 862 | set -x color_repo_staged $yellow $mantle 863 | 864 | set -x color_vi_mode_default $sky $mantle --bold 865 | set -x color_vi_mode_insert $green $mantle --bold 866 | set -x color_vi_mode_visual $mauve $mantle --bold 867 | 868 | set -x color_vagrant $surface2 $text --bold 869 | set -x color_k8s $surface2 $text --bold 870 | set -x color_aws_vault $yellow $mantle --bold 871 | set -x color_aws_vault_expired $red $mantle --bold 872 | set -x color_username $surface2 $yellow --bold 873 | set -x color_hostname $surface2 $yellow 874 | set -x color_screen $green $mantle --bold 875 | set -x color_rvm $red $mantle --bold 876 | set -x color_node $green $mantle --bold 877 | set -x color_virtualfish $peach $mantle --bold 878 | set -x color_virtualgo $sky $mantle --bold 879 | set -x color_desk $peach $mantle --bold 880 | set -x color_nix $sky $mantle --bold 881 | 882 | case 'jellybeans' # https://github.com/nanotech/jellybeans.vim 883 | set -l bg 151515 884 | set -l darker_grey 1c1c1c 885 | set -l dark_grey 262626 886 | set -l grey 888888 887 | set -l blue_grey a0a8b0 888 | set -l light_grey d8dee9 889 | set -l white ffffff 890 | set -l dark_red 902020 891 | set -l red cf6a4c 892 | set -l red_orange ffb964 893 | set -l bright_orange fad07a 894 | set -l pale_gold dad085 895 | set -l pink f0a0c0 896 | set -l lilac c6b6ee 897 | set -l dark_blue 2b5b77 898 | set -l deep_blue 0d61ac 899 | set -l blue 8197bf 900 | set -l bright_blue 7697d6 901 | set -l cyan 8fbfdc 902 | set -l blue_green 668799 903 | set -l green 799d6a 904 | set -l bright_green 70b950 905 | set -l brighter_green 65c254 906 | set -l light_green 99ad6a 907 | set -l dark_green 556633 908 | 909 | set -x color_initial_segment_exit $dark_red $white --bold 910 | set -x color_initial_segment_private $light_grey $dark_grey --bold 911 | set -x color_initial_segment_su $red_orange $darker_grey --bold 912 | set -x color_initial_segment_jobs $lilac $darker_grey --bold 913 | 914 | set -x color_path $dark_grey $light_grey 915 | set -x color_path_basename $dark_grey $light_grey --bold 916 | set -x color_path_nowrite $dark_grey $red_orange 917 | set -x color_path_nowrite_basename $dark_grey $red_orange --bold 918 | 919 | set -x color_repo $light_green $darker_grey 920 | set -x color_repo_work_tree $dark_grey $light_grey --bold 921 | set -x color_repo_dirty $red $darker_grey 922 | set -x color_repo_staged $pale_gold $darker_grey 923 | 924 | set -x color_vi_mode_default $bright_blue $darker_grey --bold 925 | set -x color_vi_mode_insert $lilac $darker_grey --bold 926 | set -x color_vi_mode_visual $cyan $darker_grey --bold 927 | 928 | set -x color_username $dark_grey $blue_grey --bold 929 | set -x color_hostname $dark_grey $blue_grey 930 | set -x color_screen $bright_green $darker_grey --bold 931 | 932 | set -x color_vagrant $lilac $darker_grey --bold 933 | set -x color_k8s $pale_gold $darker_grey --bold 934 | set -x color_aws_vault $deep_blue $pale_gold --bold 935 | set -x color_aws_vault_expired $deep_blue $red --bold 936 | set -x color_rvm $pink $darker_grey --bold 937 | set -x color_nvm $bright_green $darker_grey --bold 938 | set -x color_virtualfish $cyan $darker_grey --bold 939 | set -x color_virtualgo $light_green $darker_grey --bold 940 | set -x color_desk $light_grey $darker_grey --bold 941 | set -x color_nix $bright_blue $darker_grey --bold 942 | 943 | case 'darcula' 944 | # light medium dark darkest 945 | # ------ ------ ------ ------ 946 | set -l grey 808080 616161 595959 424242 947 | set -l red FF4050 F0524F B82421 772E2C 948 | set -l green 4FC414 5C962C 458500 39511F 949 | set -l yellow E5BF00 A68A0D A87B00 5C4F17 950 | set -l blue 1FB0FF 3993D4 1778BD 245980 951 | set -l white F9F9F4 B7C3D0 952 | 953 | set -x color_initial_segment_exit $white[2] $red[3] --bold 954 | set -x color_initial_segment_private $white[2] $grey[4] 955 | set -x color_initial_segment_su $white[2] $green[3] --bold 956 | set -x color_initial_segment_jobs $white[2] $blue[3] --bold 957 | 958 | set -x color_path $grey[4] $white[2] 959 | set -x color_path_basename $grey[4] $white[1] --bold 960 | set -x color_path_nowrite $grey[4] $red[2] 961 | set -x color_path_nowrite_basename $grey[4] $red[1] --bold 962 | 963 | set -x color_repo $green[3] $white[4] 964 | set -x color_repo_work_tree $grey[4] $grey[4] --bold 965 | set -x color_repo_dirty $red[3] $grey[4] 966 | set -x color_repo_staged $yellow[3] $grey[4] 967 | 968 | set -x color_vi_mode_default $grey[4] $yellow[2] --bold 969 | set -x color_vi_mode_insert $green[2] $grey[4] --bold 970 | set -x color_vi_mode_visual $yellow[2] $grey[4] --bold 971 | 972 | set -x color_vagrant $blue[2] $green[1] --bold 973 | set -x color_k8s $green[2] $grey[4] --bold 974 | set -x color_aws_vault $blue[2] $grey[4] --bold 975 | set -x color_aws_vault_expired $blue[2] $red[1] --bold 976 | set -x color_username $grey[4] $blue[2] --bold 977 | set -x color_hostname $grey[4] $blue[1] 978 | set -x color_screen $green[3] $white[2] --bold 979 | set -x color_rvm $red[2] $grey[4] --bold 980 | set -x color_node $green[3] $white[2] --bold 981 | set -x color_virtualfish $blue[2] $grey[4] --bold 982 | set -x color_virtualgo $blue[2] $grey[4] --bold 983 | set -x color_desk $blue[2] $grey[4] --bold 984 | set -x color_nix $blue[2] $grey[4] --bold 985 | 986 | case '*' # default dark theme 987 | # light medium dark 988 | # ------ ------ ------ 989 | set -l red cc9999 ce000f 660000 990 | set -l green addc10 189303 0c4801 991 | set -l blue 48b4fb 005faf 255e87 992 | set -l orange f6b117 unused 3a2a03 993 | set -l brown bf5e00 803f00 4d2600 994 | set -l grey cccccc 999999 333333 995 | set -l white ffffff 996 | set -l black 000000 997 | set -l ruby_red af0000 998 | set -l go_blue 00d7d7 999 | 1000 | set -x color_initial_segment_exit $white $red[2] --bold 1001 | set -x color_initial_segment_private $white $grey[3] 1002 | set -x color_initial_segment_su $white $green[2] --bold 1003 | set -x color_initial_segment_jobs $white $blue[3] --bold 1004 | 1005 | set -x color_path $grey[3] $grey[2] 1006 | set -x color_path_basename $grey[3] $white --bold 1007 | set -x color_path_nowrite $red[3] $red[1] 1008 | set -x color_path_nowrite_basename $red[3] $red[1] --bold 1009 | 1010 | set -x color_repo $green[1] $green[3] 1011 | set -x color_repo_work_tree $grey[3] $white --bold 1012 | set -x color_repo_dirty $red[2] $white 1013 | set -x color_repo_staged $orange[1] $orange[3] 1014 | 1015 | set -x color_vi_mode_default $grey[2] $grey[3] --bold 1016 | set -x color_vi_mode_insert $green[2] $grey[3] --bold 1017 | set -x color_vi_mode_visual $orange[1] $orange[3] --bold 1018 | 1019 | set -x color_vagrant $blue[1] $white --bold 1020 | set -x color_k8s $green[2] $white --bold 1021 | set -x color_aws_vault $blue[3] $orange[1] --bold 1022 | set -x color_aws_vault_expired $blue[3] $red[3] --bold 1023 | set -x color_username $grey[1] $blue[3] --bold 1024 | set -x color_hostname $grey[1] $blue[3] 1025 | set -x color_screen $green[1] $white --bold 1026 | set -x color_rvm $ruby_red $grey[1] --bold 1027 | set -x color_node $green[1] $white --bold 1028 | set -x color_virtualfish $blue[2] $grey[1] --bold 1029 | set -x color_virtualgo $go_blue $black --bold 1030 | set -x color_desk $blue[2] $grey[1] --bold 1031 | set -x color_nix $blue[2] $grey[1] --bold 1032 | end 1033 | end 1034 | 1035 | function __bobthefish_user_color_scheme_deprecated 1036 | set -q __color_initial_segment_exit; or set -l __color_initial_segment_exit ffffff ce000f --bold 1037 | set -q __color_initial_segment_private; or set -l __color_initial_segment_private ffffff 255e87 1038 | set -q __color_initial_segment_su; or set -l __color_initial_segment_su ffffff 189303 --bold 1039 | set -q __color_initial_segment_jobs; or set -l __color_initial_segment_jobs ffffff 255e87 --bold 1040 | set -q __color_path; or set -l __color_path 333333 999999 1041 | set -q __color_path_basename; or set -l __color_path_basename 333333 ffffff --bold 1042 | set -q __color_path_nowrite; or set -l __color_path_nowrite 660000 cc9999 1043 | set -q __color_path_nowrite_basename; or set -l __color_path_nowrite_basename 660000 cc9999 --bold 1044 | set -q __color_repo; or set -l __color_repo addc10 0c4801 1045 | set -q __color_repo_work_tree; or set -l __color_repo_work_tree 333333 ffffff --bold 1046 | set -q __color_repo_dirty; or set -l __color_repo_dirty ce000f ffffff 1047 | set -q __color_repo_staged; or set -l __color_repo_staged f6b117 3a2a03 1048 | set -q __color_vi_mode_default; or set -l __color_vi_mode_default 999999 333333 --bold 1049 | set -q __color_vi_mode_insert; or set -l __color_vi_mode_insert 189303 333333 --bold 1050 | set -q __color_vi_mode_visual; or set -l __color_vi_mode_visual f6b117 3a2a03 --bold 1051 | set -q __color_vagrant; or set -l __color_vagrant 48b4fb ffffff --bold 1052 | set -q __color_username; or set -l __color_username cccccc 255e87 --bold 1053 | set -q __color_hostname; or set -l __color_hostname cccccc 255e87 1054 | set -q __color_rvm; or set -l __color_rvm af0000 cccccc --bold 1055 | set -q __color_virtualfish; or set -l __color_virtualfish 005faf cccccc --bold 1056 | set -q __color_virtualgo; or set -l __color_virtualgo 005faf cccccc --bold 1057 | set -q __color_desk; or set -l __color_desk 005faf cccccc --bold 1058 | set -q __color_nix; or set -l __color_nix 005faf cccccc --bold 1059 | 1060 | set_color black -b red --bold 1061 | echo "The 'user' color scheme is deprecated." 1062 | set_color normal 1063 | set_color black -b red 1064 | echo "To define a custom color scheme, create a 'bobthefish_colors' function:" 1065 | set_color normal 1066 | echo 1067 | 1068 | echo "function bobthefish_colors -S -d 'Define a custom bobthefish color scheme' 1069 | 1070 | # optionally include a base color scheme... 1071 | ___bobthefish_colors default 1072 | 1073 | # then override everything you want! note that these must be defined with `set -x` 1074 | set -x color_initial_segment_exit $__color_initial_segment_exit 1075 | set -x color_initial_segment_private $__color_initial_segment_private 1076 | set -x color_initial_segment_su $__color_initial_segment_su 1077 | set -x color_initial_segment_jobs $__color_initial_segment_jobs 1078 | set -x color_path $__color_path 1079 | set -x color_path_basename $__color_path_basename 1080 | set -x color_path_nowrite $__color_path_nowrite 1081 | set -x color_path_nowrite_basename $__color_path_nowrite_basename 1082 | set -x color_repo $__color_repo 1083 | set -x color_repo_work_tree $__color_repo_work_tree 1084 | set -x color_repo_dirty $__color_repo_dirty 1085 | set -x color_repo_staged $__color_repo_staged 1086 | set -x color_vi_mode_default $__color_vi_mode_default 1087 | set -x color_vi_mode_insert $__color_vi_mode_insert 1088 | set -x color_vi_mode_visual $__color_vi_mode_visual 1089 | set -x color_vagrant $__color_vagrant 1090 | set -x color_aws_vault $__color_aws_vault 1091 | set -x color_aws_vault_expired $__color_aws_vault_expired 1092 | set -x color_username $__color_username 1093 | set -x color_hostname $__color_hostname 1094 | set -x color_rvm $__color_rvm 1095 | set -x color_virtualfish $__color_virtualfish 1096 | set -x color_virtualgo $__color_virtualgo 1097 | set -x color_desk $__color_desk 1098 | set -x color_nix $__color_nix 1099 | end" 1100 | 1101 | echo 1102 | end 1103 | --------------------------------------------------------------------------------