Browse Source

Switch fish to batman theme #fishfile

Colin Powell 6 years ago
parent
commit
6146684138
40 changed files with 85 additions and 1455 deletions
  1. 0 1
      fish/.config/fish/completions/a.fish
  2. 0 1
      fish/.config/fish/completions/d.fish
  3. 0 1
      fish/.config/fish/completions/f.fish
  4. 0 18
      fish/.config/fish/completions/fasd.fish
  5. 0 1
      fish/.config/fish/completions/s.fish
  6. 0 1
      fish/.config/fish/completions/sd.fish
  7. 0 1
      fish/.config/fish/completions/sf.fish
  8. 0 1
      fish/.config/fish/completions/z.fish
  9. 0 1
      fish/.config/fish/completions/zz.fish
  10. 0 3
      fish/.config/fish/conf.d/aliases.fish
  11. 6 5
      fish/.config/fish/conf.d/fzf.fish
  12. 9 4
      fish/.config/fish/conf.d/fzf_key_bindings.fish
  13. 0 44
      fish/.config/fish/conf.d/z.fish
  14. 0 4
      fish/.config/fish/fish_variables
  15. 3 3
      fish/.config/fish/fishfile
  16. 1 0
      fish/.config/fish/functions/__batman_color_dim.fish
  17. 1 0
      fish/.config/fish/functions/__batman_color_fst.fish
  18. 1 0
      fish/.config/fish/functions/__batman_color_off.fish
  19. 1 0
      fish/.config/fish/functions/__batman_color_snd.fish
  20. 1 0
      fish/.config/fish/functions/__batman_color_trd.fish
  21. 0 5
      fish/.config/fish/functions/__fasd_print_completion.fish
  22. 7 5
      fish/.config/fish/functions/__fzf_complete_preview.fish
  23. 0 151
      fish/.config/fish/functions/__z.fish
  24. 0 48
      fish/.config/fish/functions/__z_add.fish
  25. 0 10
      fish/.config/fish/functions/__z_clean.fish
  26. 0 14
      fish/.config/fish/functions/__z_complete.fish
  27. 0 3
      fish/.config/fish/functions/a.fish
  28. 2 2
      fish/.config/fish/functions/asdf.fish
  29. 0 3
      fish/.config/fish/functions/d.fish
  30. 0 3
      fish/.config/fish/functions/f.fish
  31. 0 9
      fish/.config/fish/functions/fasd_cd.fish
  32. 2 5
      fish/.config/fish/functions/fish_greeting.fish
  33. 14 993
      fish/.config/fish/functions/fish_prompt.fish
  34. 35 67
      fish/.config/fish/functions/fish_right_prompt.fish
  35. 2 33
      fish/.config/fish/functions/fish_title.fish
  36. 0 3
      fish/.config/fish/functions/s.fish
  37. 0 3
      fish/.config/fish/functions/sd.fish
  38. 0 3
      fish/.config/fish/functions/sf.fish
  39. 0 3
      fish/.config/fish/functions/z.fish
  40. 0 3
      fish/.config/fish/functions/zz.fish

+ 0 - 1
fish/.config/fish/completions/a.fish

@@ -1 +0,0 @@
-complete -c a -a "(__fasd_print_completion -a)" -f

+ 0 - 1
fish/.config/fish/completions/d.fish

@@ -1 +0,0 @@
-complete -c d -a "(__fasd_print_completion -d)" -f

+ 0 - 1
fish/.config/fish/completions/f.fish

@@ -1 +0,0 @@
-complete -c f -a "(__fasd_print_completion -f)" -f

+ 0 - 18
fish/.config/fish/completions/fasd.fish

@@ -1,18 +0,0 @@
-# suggest paths
-complete -c fasd -a "(__fasd_print_completion)" -f
-
-# suggest args
-complete -c fasd -s s -d "List all paths and scores" -f
-complete -c fasd -s l -d "List paths without scores" -f
-complete -c fasd -s i -d "Interactive mode" -f
-complete -c fasd -s e -a (echo subl atom) -d "Set command to execute on the result file" -f
-complete -c fasd -s b -a (echo spotlight viminfo recently-used current) -d "Only use given backend" -f
-complete -c fasd -s B -a (echo spotlight viminfo recently-used current) -d "Add additional backend" -f
-complete -c fasd -s a -d "Match files and directories" -f
-complete -c fasd -s d -d "Match directories only" -f
-complete -c fasd -s f -d "Match files only" -f
-complete -c fasd -s r -d "Match by rank only" -f
-complete -c fasd -s t -d "Match by recent access only" -f
-complete -c fasd -s R -d "Reverse listing order" -f
-complete -c fasd -s h -d "Show a brief help message" -f
-# complete -c fasd -s [0-9] "Select the nth entry"

+ 0 - 1
fish/.config/fish/completions/s.fish

@@ -1 +0,0 @@
-complete -c s -a "(__fasd_print_completion)" -f

+ 0 - 1
fish/.config/fish/completions/sd.fish

@@ -1 +0,0 @@
-complete -c sd -a "(__fasd_print_completion -d)" -f

+ 0 - 1
fish/.config/fish/completions/sf.fish

@@ -1 +0,0 @@
-complete -c sf -a "(__fasd_print_completion -f)" -f

+ 0 - 1
fish/.config/fish/completions/z.fish

@@ -1 +0,0 @@
-complete -c z -a "(__fasd_print_completion -d)" -f

+ 0 - 1
fish/.config/fish/completions/zz.fish

@@ -1 +0,0 @@
-complete -c zz -a "(__fasd_print_completion -d)" -f

+ 0 - 3
fish/.config/fish/conf.d/aliases.fish

@@ -1,3 +0,0 @@
-# support oldschool autojump user
-alias j  z
-alias jj zz

+ 6 - 5
fish/.config/fish/conf.d/fzf.fish

@@ -5,9 +5,10 @@ set -q FZF_PREVIEW_FILE_CMD; or set -U FZF_PREVIEW_FILE_CMD "head -n 10"
 set -q FZF_PREVIEW_DIR_CMD; or set -U FZF_PREVIEW_DIR_CMD "ls"
 
 function fzf_uninstall -e fzf_uninstall
-    set -l _vars (set | command grep -E "^FZF.*\$" | command awk '{print $1;}')
-    for var in $_vars
-        echo $var
-        eval (set -e $var)
-    end
+    # disabled until we figure out a sensible way to ensure user overrides
+    # are not erased
+    # set -l _vars (set | command grep -E "^FZF.*\$" | command awk '{print $1;}')
+    # for var in $_vars
+    #     eval (set -e $var)
+    # end
 end

+ 9 - 4
fish/.config/fish/conf.d/fzf_key_bindings.fish

@@ -34,11 +34,16 @@ end
 
 if set -q FZF_COMPLETE
     bind \t '__fzf_complete'
+    if bind -M insert >/dev/null 2>/dev/null
+        bind -M insert \t '__fzf_complete'
+    end
 end
 
 function fzf_key_bindings_uninstall -e fzf_key_bindings_uninstall
-    set -l _bindings (bind -a | sed -En "s/(')?__fzf.*\$//p" | sed 's/bind/bind -e/')
-    for binding in $_bindings
-        eval $binding
-    end
+    # disabled until we figure out a sensible way to ensure user overrides
+    # are not erased
+    # set -l _bindings (bind -a | sed -En "s/(')?__fzf.*\$//p" | sed 's/bind/bind -e/')
+    # for binding in $_bindings
+    #     eval $binding
+    # end
 end

+ 0 - 44
fish/.config/fish/conf.d/z.fish

@@ -1,44 +0,0 @@
-if test -z "$Z_DATA"
-  if test -z "$XDG_DATA_HOME"
-    set -U Z_DATA_DIR "$HOME/.local/share/z"
-  else 
-    set -U Z_DATA_DIR "$XDG_DATA_HOME/z"
-  end
-  set -U Z_DATA "$Z_DATA_DIR/data"
-end
-
-if test ! -e "$Z_DATA"
-  if test ! -e "$Z_DATA_DIR"
-    mkdir -p -m 700 "$Z_DATA_DIR"  
-  end
-  touch "$Z_DATA"
-end
-
-if test -z "$Z_CMD"
-  set -U Z_CMD "z"
-end
-
-set -U ZO_CMD "$Z_CMD"o
-
-if test ! -z $Z_CMD
-  function $Z_CMD -d "jump around"
-    __z $argv
-  end
-end
-
-if test ! -z $ZO_CMD
-  function $ZO_CMD -d "open target dir"
-    __z -d $argv
-  end
-end
-
-if not set -q Z_EXCLUDE
-  set -U Z_EXCLUDE $HOME
-end
-
-# Setup completions once first
-__z_complete
-
-function __z_on_variable_pwd --on-variable PWD
-  __z_add
-end

+ 0 - 4
fish/.config/fish/fish_variables

@@ -7,11 +7,7 @@ SETUVAR FZF_PREVIEW_FILE_CMD:head\x20\x2dn\x2010
 SETUVAR FZF_TMUX_HEIGHT:40\x25
 SETUVAR --export TERM:screen\x2d256color
 SETUVAR THEME_EDEN_PROMPT_CHAR:\u00bb
-SETUVAR ZO_CMD:zo
-SETUVAR Z_CMD:z
-SETUVAR Z_DATA:/Users/colinpowell/\x2elocal/share/z/data
 SETUVAR Z_DATA_DIR:/Users/colinpowell/\x2elocal/share/z
-SETUVAR Z_EXCLUDE:/Users/colinpowell
 SETUVAR __fish_init_2_39_8:\x1d
 SETUVAR __fish_init_2_3_0:\x1d
 SETUVAR __fish_init_3_x:\x1d

+ 3 - 3
fish/.config/fish/fishfile

@@ -1,7 +1,7 @@
+edc/bass
 jethrokuan/fzf
-2m/fish-gpg-tty
 asdf-vm/asdf
-edc/bass
+2m/fish-gpg-tty
 oh-my-fish/plugin-direnv
-oh-my-fish/theme-agnoster
 oh-my-fish/theme-bobthefish
+oh-my-fish/theme-batman

+ 1 - 0
fish/.config/fish/functions/__batman_color_dim.fish

@@ -0,0 +1 @@
+function __batman_color_dim; set_color 666; end

+ 1 - 0
fish/.config/fish/functions/__batman_color_fst.fish

@@ -0,0 +1 @@
+function __batman_color_fst; set_color -o fa0; end

+ 1 - 0
fish/.config/fish/functions/__batman_color_off.fish

@@ -0,0 +1 @@
+function __batman_color_off; set_color normal; end

+ 1 - 0
fish/.config/fish/functions/__batman_color_snd.fish

@@ -0,0 +1 @@
+function __batman_color_snd; set_color -o 36f; end

+ 1 - 0
fish/.config/fish/functions/__batman_color_trd.fish

@@ -0,0 +1 @@
+function __batman_color_trd; set_color -o f06; end

+ 0 - 5
fish/.config/fish/functions/__fasd_print_completion.fish

@@ -1,5 +0,0 @@
-# suggest paths for current args as completion
-function __fasd_print_completion
-  set cmd (commandline -po)
-  test (count $cmd) -ge 2; and fasd $argv $cmd[2..-1] -l
-end

+ 7 - 5
fish/.config/fish/functions/__fzf_complete_preview.fish

@@ -11,18 +11,20 @@ function __fzf_complete_preview -d 'generate preview for completion widget.
         echo $argv[1]
     end
 
+    set -l path (string replace "~" $HOME $argv[1])
+
     # list directories on preview
-    if test -d "$argv[1]"
-        eval $FZF_PREVIEW_DIR_CMD (string escape $argv[1])
+    if test -d "$path"
+        eval $FZF_PREVIEW_DIR_CMD (string escape $path)
     end
 
     # show ten lines of non-binary files preview
-    if test -f "$argv[1]"; and grep -qI . "$argv[1]"
-        eval $FZF_PREVIEW_FILE_CMD (string escape $argv[1])
+    if test -f "$path"; and grep -qI . "$path"
+        eval $FZF_PREVIEW_FILE_CMD (string escape $path)
     end
 
     # if fish knows about it, let it show info
-    type -q "$argv[1]" 2>/dev/null; and type -a "$argv[1]"
+    type -q "$path" 2>/dev/null; and type -a "$path"
 
     # show aditional data
     echo $argv[2]

+ 0 - 151
fish/.config/fish/functions/__z.fish

@@ -1,151 +0,0 @@
-function __z -d "Jump to a recent directory."
-    function __print_help -d "Print z help."
-        printf "Usage: $Z_CMD  [-celrth] regex1 regex2...\n\n"
-        printf "         -c --clean    Removes directories that no longer exist from $Z_DATA\n"
-        printf "         -d --dir      Opens matching directory using system file manager.\n"
-        printf "         -e --echo     Prints best match, no cd\n"
-        printf "         -l --list     List matches and scores, no cd\n"
-        printf "         -p --purge    Delete all entries from $Z_DATA\n"
-        printf "         -r --rank     Search by rank\n"
-        printf "         -t --recent   Search by recency\n"
-        printf "         -x --delete   Removes the current directory from $Z_DATA\n"
-        printf "         -h --help     Print this help\n\n"
-
-        if type -q fisher
-            printf "Run `fisher help z` for more information.\n"
-        end
-    end
-
-    set -l options "h/help" "c/clean" "e/echo" "l/list" "p/purge" "r/rank" "t/recent" "d/directory" "x/delete"
-
-    argparse $options -- $argv
-
-    if set -q _flag_help
-        __print_help
-        return 0
-    else if set -q _flag_clean
-        __z_clean
-        printf "%s cleaned!\n" $Z_DATA
-        return 0
-    else if set -q _flag_purge
-        echo > $Z_DATA
-        printf "%s purged!\n" $Z_DATA
-        return 0
-    else if set -q _flag_delete
-        sed -i -e "\:^$PWD|.*:d" $Z_DATA
-        return 0
-    end
-
-    set -l typ
-
-    if set -q _flag_rank
-        set typ "rank"
-    else if set -q _flag_recent
-        set typ "recent"
-    end
-
-    set -l z_script '
-        function frecent(rank, time) {
-            dx = t-time
-            if( dx < 3600 ) return rank*4
-            if( dx < 86400 ) return rank*2
-            if( dx < 604800 ) return rank/2
-            return rank/4
-        }
-
-        function output(matches, best_match, common) {
-            # list or return the desired directory
-            if( list ) {
-                cmd = "sort -nr"
-                for( x in matches ) {
-                    if( matches[x] ) {
-                        printf "%-10s %s\n", matches[x], x | cmd
-                    }
-                }
-                if( common ) {
-                    printf "%-10s %s\n", "common:", common > "/dev/stderr"
-                }
-            } else {
-                if( common ) best_match = common
-                print best_match
-            }
-        }
-
-        function common(matches) {
-            # find the common root of a list of matches, if it exists
-            for( x in matches ) {
-                if( matches[x] && (!short || length(x) < length(short)) ) {
-                    short = x
-                }
-            }
-            if( short == "/" ) return
-            for( x in matches ) if( matches[x] && index(x, short) != 1 ) {
-                    return
-                }
-            return short
-        }
-
-        BEGIN {
-            gsub(" ", ".*", q)
-            hi_rank = ihi_rank = -9999999999
-        }
-        {
-            if( typ == "rank" ) {
-                rank = $2
-            } else if( typ == "recent" ) {
-                rank = $3 - t
-            } else rank = frecent($2, $3)
-            if( $1 ~ q ) {
-                matches[$1] = rank
-            } else if( tolower($1) ~ tolower(q) ) imatches[$1] = rank
-            if( matches[$1] && matches[$1] > hi_rank ) {
-                best_match = $1
-                hi_rank = matches[$1]
-            } else if( imatches[$1] && imatches[$1] > ihi_rank ) {
-                ibest_match = $1
-                ihi_rank = imatches[$1]
-            }
-        }
-
-        END {
-        # prefer case sensitive
-            if( best_match ) {
-                output(matches, best_match, common(matches))
-            } else if( ibest_match ) {
-                output(imatches, ibest_match, common(imatches))
-            }
-        }
-    '
-
-    if set -q _flag_list
-        # Handle list separately as it can print common path information to stderr
-        # which cannot be captured from a subcommand.
-        command awk -v t=(date +%s) -v list="list" -v typ="$typ" -v q="$argv" -F "|" $z_script "$Z_DATA"
-    else
-        set target (command awk -v t=(date +%s) -v typ="$typ" -v q="$argv" -F "|" $z_script "$Z_DATA")
-
-        if test "$status" -gt 0
-            return
-        end
-
-        if test -z "$target"
-            printf "'%s' did not match any results\n" "$argv"
-            return 1
-        end
-
-        if set -q _flag_list
-            echo "$target" | tr ";" "\n" | sort -nr
-            return 0
-        end
-
-        if set -q _flag_echo
-            printf "%s\n" "$target"
-        else if set -q _flag_directory
-            type -q xdg-open;and xdg-open "$target"; and return $status;
-            type -q open;and open "$target"; and return $status;
-            echo "Not sure how to open file manager"; and return 1;
-        else
-            pushd "$target"
-        end
-    end
-end

+ 0 - 48
fish/.config/fish/functions/__z_add.fish

@@ -1,48 +0,0 @@
-function __z_add -d "Add PATH to .z file"
-  for i in $Z_EXCLUDE
-    if contains -- $PWD $i
-      return 0 #Path excluded
-    end
-  end
-
-  set -l tmpfile (mktemp $Z_DATA.XXXXXX)
-
-  if test -f $tmpfile
-    command awk -v path="$PWD" -v now=(date +%s) -F "|" '
-      BEGIN {
-          rank[path] = 1
-          time[path] = now
-      }
-      $2 >= 1 {
-          if( $1 == path ) {
-              rank[$1] = $2 + 1
-              time[$1] = now
-          }
-          else {
-              rank[$1] = $2
-              time[$1] = $3
-          }
-          count += $2
-      }
-      END {
-          if( count > 1000 ) {
-              for( i in rank ) print i "|" 0.9*rank[i] "|" time[i] # aging
-          }
-          else for( i in rank ) print i "|" rank[i] "|" time[i]
-      }
-    ' $Z_DATA 2>/dev/null >$tmpfile
-    
-    if test ! -z "$Z_OWNER"
-      chown $Z_OWNER:(id -ng $Z_OWNER) $tmpfile
-    end
-    #
-    # Don't use redirection here as it can lead to a race condition where $Z_DATA is clobbered.
-    # Note: There is a still a possible race condition where an old version of $Z_DATA is
-    #       read by one instance of Fish before another instance of Fish writes its copy.
-    #
-    command mv $tmpfile $Z_DATA
-    or command rm $tmpfile
-  end
-
-  __z_complete
-end

+ 0 - 10
fish/.config/fish/functions/__z_clean.fish

@@ -1,10 +0,0 @@
-function __z_clean -d "Clean up .z file to remove paths no longer valid"
-  set -l tmpfile (mktemp $Z_DATA.XXXXXX)
-
-  if test -f $tmpfile
-    command awk -F "|" 'system("test -d \"" $1 "\"") == 0 { print $0 }' $Z_DATA > $tmpfile
-    command mv -f $tmpfile $Z_DATA
-  end
-
-  __z_complete
-end

+ 0 - 14
fish/.config/fish/functions/__z_complete.fish

@@ -1,14 +0,0 @@
-function __z_complete -d "add completions"
-  set -l __z_marks (string replace -r '\|.*' '' < $Z_DATA | string escape)
-
-  complete -c $Z_CMD -a "$__z_marks" -f
-  complete -c $ZO_CMD -a "$__z_marks" -f
-
-  complete -c $Z_CMD -s c -l clean  -d "Cleans out $Z_DATA"
-  complete -c $Z_CMD -s e -l echo   -d "Prints best match, no cd"
-  complete -c $Z_CMD -s l -l list   -d "List matches, no cd"
-  complete -c $Z_CMD -s p -l purge  -d "Purges $Z_DATA"
-  complete -c $Z_CMD -s r -l rank   -d "Searches by rank, cd"
-  complete -c $Z_CMD -s t -l recent -d "Searches by recency, cd"
-  complete -c $Z_CMD -s h -l help   -d "Print help"
-end

+ 0 - 3
fish/.config/fish/functions/a.fish

@@ -1,3 +0,0 @@
-function a -d "Match files and directories"
-  fasd -a $argv
-end

+ 2 - 2
fish/.config/fish/functions/asdf.fish

@@ -1,12 +1,12 @@
 #!/usr/bin/env fish
 
-set -l asdf_dir (dirname (status -f))
+set -x ASDF_DIR (dirname (status -f))
 set -l asdf_data_dir (
   if test -n "$ASDF_DATA_DIR"; echo $ASDF_DATA_DIR;
   else; echo $HOME/.asdf; end)
 
 # Add asdf to PATH
-set -l asdf_bin_dirs $asdf_dir/bin $asdf_dir/shims $asdf_data_dir/shims
+set -l asdf_bin_dirs $ASDF_DIR/bin $ASDF_DIR/shims $asdf_data_dir/shims
 
 for x in $asdf_bin_dirs
   if begin not contains $x $fish_user_paths; and test -d $x; end

+ 0 - 3
fish/.config/fish/functions/d.fish

@@ -1,3 +0,0 @@
-function d -d "Match directories only"
-  fasd -d $argv
-end

+ 0 - 3
fish/.config/fish/functions/f.fish

@@ -1,3 +0,0 @@
-function f -d "Match files only"
-  fasd -f $argv
-end

+ 0 - 9
fish/.config/fish/functions/fasd_cd.fish

@@ -1,9 +0,0 @@
-function fasd_cd -d "fasd builtin cd"
-  if test (count $argv) -le 1
-    command fasd "$argv"
-  else
-    set -l ret (command fasd -e 'printf %s' $argv)
-    test -z "$ret"; and return
-    test -d "$ret"; and cd "$ret"; or printf "%s\n" $ret
-  end
-end

+ 2 - 5
fish/.config/fish/functions/fish_greeting.fish

@@ -1,6 +1,3 @@
-function fish_greeting -d "What's up, fish?"
-    set_color $fish_color_autosuggestion
-    uname -nmsr
-    uptime
-    set_color normal
+function fish_greeting
+  echo (__batman_color_dim)(uname -mnprs)(__batman_color_off)
 end

+ 14 - 993
fish/.config/fish/functions/fish_prompt.fish

@@ -1,999 +1,20 @@
-# name: bobthefish
-#
-# bobthefish is a Powerline-style, Git-aware fish theme optimized for awesome.
-#
-# You will need a Powerline-patched font for this to work:
-#
-#     https://powerline.readthedocs.org/en/master/installation.html#patched-fonts
-#
-# I recommend picking one of these:
-#
-#     https://github.com/Lokaltog/powerline-fonts
-#
-# For more advanced awesome, install a nerd fonts patched font (and be sure to
-# enable nerd fonts support with `set -g theme_nerd_fonts yes`):
-#
-#     https://github.com/ryanoasis/nerd-fonts
-#
-# You can override some default prompt options in your config.fish:
-#
-#     set -g theme_display_git no
-#     set -g theme_display_git_dirty no
-#     set -g theme_display_git_untracked no
-#     set -g theme_display_git_ahead_verbose yes
-#     set -g theme_display_git_dirty_verbose yes
-#     set -g theme_display_git_master_branch yes
-#     set -g theme_git_worktree_support yes
-#     set -g theme_display_vagrant yes
-#     set -g theme_display_docker_machine no
-#     set -g theme_display_k8s_context yes
-#     set -g theme_display_hg yes
-#     set -g theme_display_virtualenv no
-#     set -g theme_display_ruby no
-#     set -g theme_display_user ssh
-#     set -g theme_display_hostname ssh
-#     set -g theme_display_vi no
-#     set -g theme_avoid_ambiguous_glyphs yes
-#     set -g theme_powerline_fonts no
-#     set -g theme_nerd_fonts yes
-#     set -g theme_show_exit_status yes
-#     set -g default_user your_normal_user
-#     set -g theme_color_scheme dark
-#     set -g fish_prompt_pwd_dir_length 0
-#     set -g theme_project_dir_length 1
-#     set -g theme_newline_cursor yes
+function fish_prompt
+  test $status -ne 0;
+    and set -l colors 600 900 c00
+    or set -l colors 333 666 aaa
 
+  set -l pwd (prompt_pwd)
+  set -l base (basename "$pwd")
 
-# ==============================
-# Helper methods
-# ==============================
+  set -l expr "s|~|"(__batman_color_fst)"^^"(__batman_color_off)"|g; \
+               s|/|"(__batman_color_snd)"/"(__batman_color_off)"|g;  \
+               s|"$base"|"(__batman_color_fst)$base(__batman_color_off)" |g"
 
-function __bobthefish_basename -d 'basically basename, but faster'
-    string replace -r '^.*/' '' -- $argv
-end
-
-function __bobthefish_dirname -d 'basically dirname, but faster'
-    string replace -r '/[^/]+/?$' '' -- $argv
-end
-
-function __bobthefish_git_branch -S -d 'Get the current git branch (or commitish)'
-    set -l ref (command git symbolic-ref HEAD 2>/dev/null)
-    and begin
-        [ "$theme_display_git_master_branch" != 'yes' -a "$ref" = 'refs/heads/master' ]
-        and echo $branch_glyph
-        and return
-
-        string replace 'refs/heads/' "$branch_glyph " $ref
-        and return
-    end
-
-    set -l tag (command git describe --tags --exact-match 2>/dev/null)
-    and echo "$tag_glyph $tag"
-    and return
-
-    set -l branch (command git show-ref --head -s --abbrev | head -n1 2>/dev/null)
-    echo "$detached_glyph $branch"
-end
-
-function __bobthefish_hg_branch -S -d 'Get the current hg branch'
-    set -l branch (command hg branch 2>/dev/null)
-    set -l book (command hg book | command grep \* | cut -d\  -f3)
-    echo "$branch_glyph $branch @ $book"
-end
-
-function __bobthefish_pretty_parent -S -a child_dir -d 'Print a parent directory, shortened to fit the prompt'
-    set -q fish_prompt_pwd_dir_length
-    or set -l fish_prompt_pwd_dir_length 1
-
-    # Replace $HOME with ~
-    set -l real_home ~
-    set -l parent_dir (string replace -r '^'"$real_home"'($|/)' '~$1' (__bobthefish_dirname $child_dir))
-
-    # Must check whether `$parent_dir = /` if using native dirname
-    if [ -z "$parent_dir" ]
-        echo -n /
-        return
-    end
-
-    if [ $fish_prompt_pwd_dir_length -eq 0 ]
-        echo -n "$parent_dir/"
-        return
-    end
-
-    string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' "$parent_dir/"
-end
-
-function __bobthefish_ignore_vcs_dir -d 'Check whether the current directory should be ignored as a VCS segment'
-    set -l real_pwd (realpath $PWD)
-    for p in $theme_vcs_ignore_paths
-        set ignore_path (realpath $p 2>/dev/null)
-        switch $real_pwd/
-            case $ignore_path/\*
-                echo 1
-                return
-        end
-    end
-end
-
-function __bobthefish_git_project_dir -S -d 'Print the current git project base directory'
-    [ "$theme_display_git" = 'no' ]
-    and return
-
-    set -q theme_vcs_ignore_paths
-    and [ (__bobthefish_ignore_vcs_dir) ]
-    and return
-
-    if [ "$theme_git_worktree_support" != 'yes' ]
-        set -l git_toplevel (command git rev-parse --show-toplevel 2>/dev/null)
-
-        [ -z "$git_toplevel" ]
-        and return
-
-        # If there are no symlinks, just use git toplevel
-        switch $PWD/
-            case $git_toplevel/\*
-                echo $git_toplevel
-                return
-        end
-
-        # Otherwise, we need to find the equivalent directory in the $PWD
-        set -l d $PWD
-        while not [ -z "$d" ]
-            if [ (realpath "$d") = "$git_toplevel" ]
-                echo $d
-                return
-            end
-
-            [ "$d" = '/' ]
-            and return
-
-            set d (__bobthefish_dirname $d)
-        end
-        return
-    end
-
-    set -l git_dir (command git rev-parse --git-dir 2>/dev/null)
-    or return
-
-    pushd $git_dir
-    set git_dir $PWD
-    popd
-
-    switch $PWD/
-        case $git_dir/\*
-            # Nothing works quite right if we're inside the git dir
-            # TODO: fix the underlying issues then re-enable the stuff below
-
-            # # if we're inside the git dir, sweet. just return that.
-            # set -l toplevel (command git rev-parse --show-toplevel 2>/dev/null)
-            # if [ "$toplevel" ]
-            #   switch $git_dir/
-            #     case $toplevel/\*
-            #       echo $git_dir
-            #   end
-            # end
-            return
-    end
-
-    set -l project_dir (__bobthefish_dirname $git_dir)
-
-    switch $PWD/
-        case $project_dir/\*
-            echo $project_dir
-            return
-    end
-
-    set project_dir (command git rev-parse --show-toplevel 2>/dev/null)
-    switch $PWD/
-        case $project_dir/\*
-            echo $project_dir
-    end
-end
-
-function __bobthefish_hg_project_dir -S -d 'Print the current hg project base directory'
-    [ "$theme_display_hg" = 'yes' ]
-    or return
-
-    set -q theme_vcs_ignore_paths
-    and [ (__bobthefish_ignore_vcs_dir) ]
-    and return
-
-    set -l d $PWD
-    while not [ -z "$d" ]
-        if [ -e $d/.hg ]
-            command hg root --cwd "$d" 2>/dev/null
-            return
-        end
-
-        [ "$d" = '/' ]
-        and return
-
-        set d (__bobthefish_dirname $d)
-    end
-end
-
-function __bobthefish_project_pwd -S -a project_root_dir -d 'Print the working directory relative to project root'
-    set -q theme_project_dir_length
-    or set -l theme_project_dir_length 0
-
-    set -l project_dir (string replace -r '^'"$project_root_dir"'($|/)' '' $PWD)
-
-    if [ $theme_project_dir_length -eq 0 ]
-        echo -n $project_dir
-        return
-    end
-
-    string replace -ar '(\.?[^/]{'"$theme_project_dir_length"'})[^/]*/' '$1/' $project_dir
-end
-
-function __bobthefish_git_ahead -S -d 'Print the ahead/behind state for the current branch'
-    if [ "$theme_display_git_ahead_verbose" = 'yes' ]
-        __bobthefish_git_ahead_verbose
-        return
-    end
-
-    set -l ahead 0
-    set -l behind 0
-    for line in (command git rev-list --left-right '@{upstream}...HEAD' 2>/dev/null)
-        switch "$line"
-            case '>*'
-                if [ $behind -eq 1 ]
-                    echo '±'
-                    return
-                end
-                set ahead 1
-            case '<*'
-                if [ $ahead -eq 1 ]
-                    echo "$git_plus_minus_glyph"
-                    return
-                end
-                set behind 1
-        end
-    end
-
-    if [ $ahead -eq 1 ]
-        echo "$git_plus_glyph"
-    else if [ $behind -eq 1 ]
-        echo "$git_minus_glyph"
-    end
-end
-
-function __bobthefish_git_ahead_verbose -S -d 'Print a more verbose ahead/behind state for the current branch'
-    set -l commits (command git rev-list --left-right '@{upstream}...HEAD' 2>/dev/null)
-    or return
-
-    set -l behind (count (for arg in $commits; echo $arg; end | command grep '^<'))
-    set -l ahead (count (for arg in $commits; echo $arg; end | command grep -v '^<'))
-
-    switch "$ahead $behind"
-        case '' # no upstream
-        case '0 0' # equal to upstream
-            return
-        case '* 0' # ahead of upstream
-            echo "$git_ahead_glyph$ahead"
-        case '0 *' # behind upstream
-            echo "$git_behind_glyph$behind"
-        case '*' # diverged from upstream
-            echo "$git_ahead_glyph$ahead$git_behind_glyph$behind"
-    end
-end
-
-function __bobthefish_git_dirty_verbose -S -d 'Print a more verbose dirty state for the current working tree'
-    set -l changes (command git diff --numstat | awk '{ added += $1; removed += $2 } END { print "+" added "/-" removed }')
-    or return
-
-    echo "$changes " | string replace -r '(\+0/(-0)?|/-0)' ''
-end
-
-
-# ==============================
-# Segment functions
-# ==============================
-
-function __bobthefish_start_segment -S -d 'Start a prompt segment'
-    set -l bg $argv[1]
-    set -e argv[1]
-    set -l fg $argv[1]
-    set -e argv[1]
-
-    set_color normal # clear out anything bold or underline...
-    set_color -b $bg $fg $argv
-
-    switch "$__bobthefish_current_bg"
-        case ''
-            # If there's no background, just start one
-            echo -n ' '
-        case "$bg"
-            # If the background is already the same color, draw a separator
-            echo -ns $right_arrow_glyph ' '
-        case '*'
-            # otherwise, draw the end of the previous segment and the start of the next
-            set_color $__bobthefish_current_bg
-            echo -ns $right_black_arrow_glyph ' '
-            set_color $fg $argv
-    end
-
-    set __bobthefish_current_bg $bg
-end
-
-function __bobthefish_path_segment -S -a segment_dir -d 'Display a shortened form of a directory'
-    set -l segment_color $color_path
-    set -l segment_basename_color $color_path_basename
-
-    if not [ -w "$segment_dir" ]
-        set segment_color $color_path_nowrite
-        set segment_basename_color $color_path_nowrite_basename
-    end
-
-    __bobthefish_start_segment $segment_color
-
-    set -l directory
-    set -l parent
-
-    switch "$segment_dir"
-        case /
-            set directory '/'
-        case "$HOME"
-            set directory '~'
-        case '*'
-            set parent (__bobthefish_pretty_parent "$segment_dir")
-            set directory (__bobthefish_basename "$segment_dir")
-    end
-
-    echo -n $parent
-    set_color -b $segment_basename_color
-    echo -ns $directory ' '
-end
-
-function __bobthefish_finish_segments -S -d 'Close open prompt segments'
-    if [ -n "$__bobthefish_current_bg" ]
-        set_color normal
-        set_color $__bobthefish_current_bg
-        echo -ns $right_black_arrow_glyph ' '
-    end
-
-    if [ "$theme_newline_cursor" = 'yes' ]
-        echo -ens "\n"
-        set_color $fish_color_autosuggestion
-        if [ "$theme_powerline_fonts" = "no" ]
-            echo -ns '> '
-        else
-            echo -ns "$right_arrow_glyph "
-        end
-    else if [ "$theme_newline_cursor" = 'clean' ]
-        echo -ens "\n"
-    end
-
-    set_color normal
-    set __bobthefish_current_bg
-end
-
-
-# ==============================
-# Status and input mode segments
-# ==============================
-
-function __bobthefish_prompt_status -S -a last_status -d 'Display flags for a non-zero exit status, root user, and background jobs'
-    set -l nonzero
-    set -l superuser
-    set -l bg_jobs
-
-    # Last exit was nonzero
-    [ $last_status -ne 0 ]
-    and set nonzero 1
-
-    # If superuser (uid == 0)
-    #
-    # Note that iff the current user is root and '/' is not writeable by root this
-    # will be wrong. But I can't think of a single reason that would happen, and
-    # it is literally 99.5% faster to check it this way, so that's a tradeoff I'm
-    # willing to make.
-    [ -w / ]
-    and [ (id -u) -eq 0 ]
-    and set superuser 1
-
-    # Jobs display
-    jobs -p >/dev/null
-    and set bg_jobs 1
-
-    if [ "$nonzero" -o "$superuser" -o "$bg_jobs" ]
-        __bobthefish_start_segment $color_initial_segment_exit
-        if [ "$nonzero" ]
-            set_color normal
-            set_color -b $color_initial_segment_exit
-            if [ "$theme_show_exit_status" = 'yes' ]
-                echo -ns $last_status ' '
-            else
-                echo -n $nonzero_exit_glyph
-            end
-        end
-
-        if [ "$superuser" ]
-            set_color normal
-            if [ -z "$FAKEROOTKEY" ]
-                set_color -b $color_initial_segment_su
-            else
-                set_color -b $color_initial_segment_exit
-            end
-
-            echo -n $superuser_glyph
-        end
-
-        if [ "$bg_jobs" ]
-            set_color normal
-            set_color -b $color_initial_segment_jobs
-            echo -n $bg_job_glyph
-        end
-    end
-end
-
-function __bobthefish_prompt_vi -S -d 'Display vi mode'
-    [ "$theme_display_vi" != 'no' ]
-    or return
-
-    [ "$fish_key_bindings" = 'fish_vi_key_bindings' \
-        -o "$fish_key_bindings" = 'hybrid_bindings' \
-        -o "$fish_key_bindings" = 'fish_hybrid_key_bindings' \
-        -o "$theme_display_vi" = 'yes' ]
-    or return
-
-    switch $fish_bind_mode
-        case default
-            __bobthefish_start_segment $color_vi_mode_default
-            echo -n 'N '
-        case insert
-            __bobthefish_start_segment $color_vi_mode_insert
-            echo -n 'I '
-        case replace_one replace-one
-            __bobthefish_start_segment $color_vi_mode_insert
-            echo -n 'R '
-        case visual
-            __bobthefish_start_segment $color_vi_mode_visual
-            echo -n 'V '
-    end
-end
-
-
-# ==============================
-# Container and VM segments
-# ==============================
-
-function __bobthefish_prompt_vagrant -S -d 'Display Vagrant status'
-    [ "$theme_display_vagrant" = 'yes' -a -f Vagrantfile ]
-    or return
-
-    # .vagrant/machines/$machine/$provider/id
-    for file in .vagrant/machines/*/*/id
-        read -l id <"$file"
-
-        if [ -n "$id" ]
-            switch "$file"
-                case '*/virtualbox/id'
-                    __bobthefish_prompt_vagrant_vbox $id
-                case '*/vmware_fusion/id'
-                    __bobthefish_prompt_vagrant_vmware $id
-                case '*/parallels/id'
-                    __bobthefish_prompt_vagrant_parallels $id
-            end
-        end
-    end
-end
-
-function __bobthefish_prompt_vagrant_vbox -S -a id -d 'Display VirtualBox Vagrant status'
-    set -l vagrant_status
-    set -l vm_status (VBoxManage showvminfo --machinereadable $id 2>/dev/null | command grep 'VMState=' | tr -d '"' | cut -d '=' -f 2)
-
-    switch "$vm_status"
-        case 'running'
-            set vagrant_status "$vagrant_status$vagrant_running_glyph"
-        case 'poweroff'
-            set vagrant_status "$vagrant_status$vagrant_poweroff_glyph"
-        case 'aborted'
-            set vagrant_status "$vagrant_status$vagrant_aborted_glyph"
-        case 'saved'
-            set vagrant_status "$vagrant_status$vagrant_saved_glyph"
-        case 'stopping'
-            set vagrant_status "$vagrant_status$vagrant_stopping_glyph"
-        case ''
-            set vagrant_status "$vagrant_status$vagrant_unknown_glyph"
-    end
-
-    [ -z "$vagrant_status" ]
-    and return
-
-    __bobthefish_start_segment $color_vagrant
-    echo -ns $vagrant_status ' '
-end
-
-function __bobthefish_prompt_vagrant_vmware -S -a id -d 'Display VMWare Vagrant status'
-    set -l vagrant_status
-    if [ (pgrep -f "$id") ]
-        set vagrant_status "$vagrant_status$vagrant_running_glyph"
-    else
-        set vagrant_status "$vagrant_status$vagrant_poweroff_glyph"
-    end
-
-    [ -z "$vagrant_status" ]
-    and return
-
-    __bobthefish_start_segment $color_vagrant
-    echo -ns $vagrant_status ' '
-end
-
-function __bobthefish_prompt_vagrant_parallels -S -d 'Display Parallels Vagrant status'
-    set -l vagrant_status
-    set -l vm_status (prlctl list $id -o status 2>/dev/null | command tail -1)
-
-    switch "$vm_status"
-        case 'running'
-            set vagrant_status "$vagrant_status$vagrant_running_glyph"
-        case 'stopped'
-            set vagrant_status "$vagrant_status$vagrant_poweroff_glyph"
-        case 'paused'
-            set vagrant_status "$vagrant_status$vagrant_saved_glyph"
-        case 'suspended'
-            set vagrant_status "$vagrant_status$vagrant_saved_glyph"
-        case 'stopping'
-            set vagrant_status "$vagrant_status$vagrant_stopping_glyph"
-        case ''
-            set vagrant_status "$vagrant_status$vagrant_unknown_glyph"
-    end
-
-    [ -z "$vagrant_status" ]
-    and return
-
-    __bobthefish_start_segment $color_vagrant
-    echo -ns $vagrant_status ' '
-end
-
-function __bobthefish_prompt_docker -S -d 'Display Docker machine name'
-    [ "$theme_display_docker_machine" = 'no' -o -z "$DOCKER_MACHINE_NAME" ]
-    and return
-
-    __bobthefish_start_segment $color_vagrant
-    echo -ns $DOCKER_MACHINE_NAME ' '
-end
-
-function __bobthefish_prompt_k8s_context -S -d 'Show current Kubernetes context'
-    [ "$theme_display_k8s_context" = 'yes' ]
-    or return
-
-    set -l config_paths "$HOME/.kube/config"
-    [ -n "$KUBECONFIG" ]
-    and set config_paths (string split ':' "$KUBECONFIG") $config_paths
-
-    for file in $config_paths
-        [ -f "$file" ]
-        or continue
-
-        while read -l key val
-            if [ "$key" = 'current-context:' ]
-                set -l context (string trim -c '"\' ' -- $val)
-                [ -z "$context" ]
-                and return
-
-                __bobthefish_start_segment $color_k8s
-                echo -ns $context ' '
-                return
-            end
-        end <$file
-    end
-end
-
-
-# ==============================
-# User / hostname info segments
-# ==============================
-
-# Polyfill for fish < 2.5.0
-if not type -q prompt_hostname
-    if not set -q __bobthefish_prompt_hostname
-        set -g __bobthefish_prompt_hostname (hostname | string replace -r '\..*' '')
-    end
-
-    function prompt_hostname
-        echo $__bobthefish_prompt_hostname
-    end
-end
-
-function __bobthefish_prompt_user -S -d 'Display current user and hostname'
-    [ "$theme_display_user" = 'yes' -o \( "$theme_display_user" != 'no' -a -n "$SSH_CLIENT" \) -o \( -n "$default_user" -a "$USER" != "$default_user" \) ]
-    and set -l display_user
-
-    [ "$theme_display_hostname" = 'yes' -o \( "$theme_display_hostname" != 'no' -a -n "$SSH_CLIENT" \) ]
-    and set -l display_hostname
-
-    if set -q display_user
-        __bobthefish_start_segment $color_username
-        echo -ns (whoami)
-    end
-
-    if set -q display_hostname
-        if set -q display_user
-            # reset colors without starting a new segment...
-            # (so we can have a bold username and non-bold hostname)
-            set_color normal
-            set_color -b $color_hostname[1] $color_hostname[2..-1]
-            echo -ns '@' (prompt_hostname)
-        else
-            __bobthefish_start_segment $color_hostname
-            echo -ns (prompt_hostname)
-        end
-    end
-
-    set -q display_user
-    or set -q display_hostname
-    and echo -ns ' '
-end
-
-
-# ==============================
-# Virtual environment segments
-# ==============================
-
-function __bobthefish_rvm_parse_ruby -S -a ruby_string scope -d 'Parse RVM Ruby string'
-    # Function arguments:
-    # - 'ruby-2.2.3@rails', 'jruby-1.7.19'...
-    # - 'default' or 'current'
-    set -l IFS @
-    echo "$ruby_string" | read __ruby __rvm_{$scope}_ruby_gemset __
-    set IFS -
-    echo "$__ruby" | read __rvm_{$scope}_ruby_interpreter __rvm_{$scope}_ruby_version __
-    set -e __ruby
-    set -e __
-end
-
-function __bobthefish_rvm_info -S -d 'Current Ruby information from RVM'
-    # look for rvm install path
-    set -q rvm_path
-    or set -l rvm_path ~/.rvm /usr/local/rvm
-
-    # More `sed`/`grep`/`cut` magic...
-    set -l __rvm_default_ruby (grep GEM_HOME $rvm_path/environments/default 2>/dev/null | sed -e"s/'//g" | sed -e's/.*\///')
-    set -l __rvm_current_ruby (rvm-prompt i v g)
-
-    [ "$__rvm_default_ruby" = "$__rvm_current_ruby" ]
-    and return
-
-    set -l __rvm_default_ruby_gemset
-    set -l __rvm_default_ruby_interpreter
-    set -l __rvm_default_ruby_version
-    set -l __rvm_current_ruby_gemset
-    set -l __rvm_current_ruby_interpreter
-    set -l __rvm_current_ruby_version
-
-    # Parse default and current Rubies to global variables
-    __bobthefish_rvm_parse_ruby $__rvm_default_ruby default
-    __bobthefish_rvm_parse_ruby $__rvm_current_ruby current
-    # Show unobtrusive RVM prompt
-
-    # If interpreter differs form default interpreter, show everything:
-    if [ "$__rvm_default_ruby_interpreter" != "$__rvm_current_ruby_interpreter" ]
-        if [ "$__rvm_current_ruby_gemset" = 'global' ]
-            rvm-prompt i v
-        else
-            rvm-prompt i v g
-        end
-        # If version differs form default version
-    else if [ "$__rvm_default_ruby_version" != "$__rvm_current_ruby_version" ]
-        if [ "$__rvm_current_ruby_gemset" = 'global' ]
-            rvm-prompt v
-        else
-            rvm-prompt v g
-        end
-        # If gemset differs form default or 'global' gemset, just show it
-    else if [ "$__rvm_default_ruby_gemset" != "$__rvm_current_ruby_gemset" ]
-        rvm-prompt g
-    end
-end
-
-function __bobthefish_prompt_rubies -S -d 'Display current Ruby information'
-    [ "$theme_display_ruby" = 'no' ]
-    and return
-
-    set -l ruby_version
-    if type -fq rvm-prompt
-        set ruby_version (__bobthefish_rvm_info)
-    else if type -fq rbenv
-        set ruby_version (rbenv version-name)
-        # Don't show global ruby version...
-        set -q RBENV_ROOT
-        or set -l RBENV_ROOT $HOME/.rbenv
-
-        [ -e "$RBENV_ROOT/version" ]
-        and read -l global_ruby_version <"$RBENV_ROOT/version"
-
-        [ "$global_ruby_version" ]
-        or set -l global_ruby_version system
-
-        [ "$ruby_version" = "$global_ruby_version" ]
-        and return
-    else if type -q chruby # chruby is implemented as a function, so omitting the -f is intentional
-        set ruby_version $RUBY_VERSION
-    else if type -fq asdf
-        asdf current ruby 2>/dev/null | read -l asdf_ruby_version asdf_provenance
-        or return
-
-        # If asdf changes their ruby version provenance format, update this to match
-        [ "$asdf_provenance" = "(set by $HOME/.tool-versions)" ]
-        and return
-
-        set ruby_version $asdf_ruby_version
-    end
-
-    [ -z "$ruby_version" ]
-    and return
-
-    __bobthefish_start_segment $color_rvm
-    echo -ns $ruby_glyph $ruby_version ' '
-end
-
-function __bobthefish_virtualenv_python_version -S -d 'Get current Python version'
-    switch (python --version 2>&1 | tr '\n' ' ')
-        case 'Python 2*PyPy*'
-            echo $pypy_glyph
-        case 'Python 3*PyPy*'
-            echo -s $pypy_glyph $superscript_glyph[3]
-        case 'Python 2*'
-            echo $superscript_glyph[2]
-        case 'Python 3*'
-            echo $superscript_glyph[3]
-    end
-end
-
-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."
-    [ "$theme_display_virtualenv" = 'no' -o -z "$VIRTUAL_ENV" -a -z "$CONDA_DEFAULT_ENV" ]
-    and return
-
-    set -l version_glyph (__bobthefish_virtualenv_python_version)
-
-    if [ "$version_glyph" ]
-        __bobthefish_start_segment $color_virtualfish
-        echo -ns $virtualenv_glyph $version_glyph ' '
-    end
-
-    if [ "$VIRTUAL_ENV" ]
-        echo -ns (basename "$VIRTUAL_ENV") ' '
-    else if [ "$CONDA_DEFAULT_ENV" ]
-        echo -ns (basename "$CONDA_DEFAULT_ENV") ' '
-    end
-end
-
-function __bobthefish_prompt_virtualgo -S -d 'Display current Go virtual environment'
-    [ "$theme_display_virtualgo" = 'no' -o -z "$VIRTUALGO" ]
-    and return
-
-    __bobthefish_start_segment $color_virtualgo
-    echo -ns $go_glyph ' ' (basename "$VIRTUALGO") ' '
-    set_color normal
-end
-
-function __bobthefish_prompt_desk -S -d 'Display current desk environment'
-    [ "$theme_display_desk" = 'no' -o -z "$DESK_ENV" ]
-    and return
-
-    __bobthefish_start_segment $color_desk
-    echo -ns $desk_glyph ' ' (basename  -a -s ".fish" "$DESK_ENV") ' '
-    set_color normal
-end
-
-
-# ==============================
-# VCS segments
-# ==============================
-
-function __bobthefish_prompt_hg -S -a hg_root_dir -d 'Display the actual hg state'
-    set -l dirty (command hg stat; or echo -n '*')
-
-    set -l flags "$dirty"
-    [ "$flags" ]
-    and set flags ""
-
-    set -l flag_colors $color_repo
-    if [ "$dirty" ]
-        set flag_colors $color_repo_dirty
-    end
-
-    __bobthefish_path_segment $hg_root_dir
-
-    __bobthefish_start_segment $flag_colors
-    echo -ns $hg_glyph ' '
-
-    __bobthefish_start_segment $flag_colors
-    echo -ns (__bobthefish_hg_branch) $flags ' '
-    set_color normal
-
-    set -l project_pwd (__bobthefish_project_pwd $hg_root_dir)
-    if [ "$project_pwd" ]
-        if [ -w "$PWD" ]
-            __bobthefish_start_segment $color_path
-        else
-            __bobthefish_start_segment $color_path_nowrite
-        end
-
-        echo -ns $project_pwd ' '
-    end
-end
-
-function __bobthefish_prompt_git -S -a git_root_dir -d 'Display the actual git state'
-    set -l dirty ''
-    if [ "$theme_display_git_dirty" != 'no' ]
-        set -l show_dirty (command git config --bool bash.showDirtyState 2>/dev/null)
-        if [ "$show_dirty" != 'false' ]
-            set dirty (command git diff --no-ext-diff --quiet --exit-code 2>/dev/null; or echo -n "$git_dirty_glyph")
-            if [ "$dirty" -a "$theme_display_git_dirty_verbose" = 'yes' ]
-                set dirty "$dirty"(__bobthefish_git_dirty_verbose)
-            end
-        end
-    end
-
-    set -l staged (command git diff --cached --no-ext-diff --quiet --exit-code 2>/dev/null; or echo -n "$git_staged_glyph")
-    set -l stashed (command git rev-parse --verify --quiet refs/stash >/dev/null; and echo -n "$git_stashed_glyph")
-    set -l ahead (__bobthefish_git_ahead)
-
-    set -l new ''
-    if [ "$theme_display_git_untracked" != 'no' ]
-        set -l show_untracked (command git config --bool bash.showUntrackedFiles 2>/dev/null)
-        if [ "$show_untracked" != 'false' ]
-            set new (command git ls-files --other --exclude-standard --directory --no-empty-directory 2>/dev/null)
-            if [ "$new" ]
-                set new "$git_untracked_glyph"
-            end
-        end
-    end
-
-    set -l flags "$dirty$staged$stashed$ahead$new"
-
-    [ "$flags" ]
-    and set flags " $flags"
-
-    set -l flag_colors $color_repo
-    if [ "$dirty" ]
-        set flag_colors $color_repo_dirty
-    else if [ "$staged" ]
-        set flag_colors $color_repo_staged
-    end
-
-    __bobthefish_path_segment $git_root_dir
-
-    __bobthefish_start_segment $flag_colors
-    echo -ns (__bobthefish_git_branch) $flags ' '
-    set_color normal
-
-    if [ "$theme_git_worktree_support" != 'yes' ]
-        set -l project_pwd (__bobthefish_project_pwd $git_root_dir)
-        if [ "$project_pwd" ]
-            if [ -w "$PWD" ]
-                __bobthefish_start_segment $color_path
-            else
-                __bobthefish_start_segment $color_path_nowrite
-            end
-
-            echo -ns $project_pwd ' '
-        end
-        return
-    end
-
-    set -l project_pwd (command git rev-parse --show-prefix 2>/dev/null | string trim --right --chars=/)
-    set -l work_dir (command git rev-parse --show-toplevel 2>/dev/null)
-
-    # only show work dir if it's a parent…
-    if [ "$work_dir" ]
-        switch $PWD/
-            case $work_dir/\*
-                string match "$git_root_dir*" $work_dir >/dev/null
-                and set work_dir (string sub -s (math 1 + (string length $git_root_dir)) $work_dir)
-            case \*
-                set -e work_dir
-        end
-    end
-
-    if [ "$project_pwd" -o "$work_dir" ]
-        set -l colors $color_path
-        if not [ -w "$PWD" ]
-            set colors $color_path_nowrite
-        end
-
-        __bobthefish_start_segment $colors
-
-        # handle work_dir != project dir
-        if [ "$work_dir" ]
-            set -l work_parent (__bobthefish_dirname $work_dir)
-            if [ "$work_parent" ]
-                echo -n "$work_parent/"
-            end
-
-            set_color normal
-            set_color -b $color_repo_work_tree
-            echo -n (__bobthefish_basename $work_dir)
-
-            set_color normal
-            set_color -b $colors
-            [ "$project_pwd" ]
-            and echo -n '/'
-        end
-
-        echo -ns $project_pwd ' '
-    else
-        set project_pwd $PWD
-
-        string match "$git_root_dir*" $project_pwd >/dev/null
-        and set project_pwd (string sub -s (math 1 + (string length $git_root_dir)) $project_pwd)
-
-        set project_pwd (string trim --left --chars=/ -- $project_pwd)
-
-        if [ "$project_pwd" ]
-            set -l colors $color_path
-            if not [ -w "$PWD" ]
-                set colors $color_path_nowrite
-            end
-
-            __bobthefish_start_segment $colors
-
-            echo -ns $project_pwd ' '
-        end
-    end
-end
-
-function __bobthefish_prompt_dir -S -d 'Display a shortened form of the current directory'
-    __bobthefish_path_segment "$PWD"
-end
-
-
-# ==============================
-# Apply theme
-# ==============================
-
-function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
-    # Save the last status for later (do this before the `set` calls below)
-    set -l last_status $status
-
-    __bobthefish_glyphs
-    __bobthefish_colors $theme_color_scheme
-
-    type -q bobthefish_colors
-    and bobthefish_colors
-
-    # Start each line with a blank slate
-    set -l __bobthefish_current_bg
-
-    # Status flags and input mode
-    __bobthefish_prompt_status $last_status
-    __bobthefish_prompt_vi
-
-    # Containers and VMs
-    __bobthefish_prompt_vagrant
-    __bobthefish_prompt_docker
-    __bobthefish_prompt_k8s_context
-
-    # User / hostname info
-    __bobthefish_prompt_user
-
-    # Virtual environments
-    __bobthefish_prompt_desk
-    __bobthefish_prompt_rubies
-    __bobthefish_prompt_virtualfish
-    __bobthefish_prompt_virtualgo
-
-    # VCS
-    set -l git_root_dir (__bobthefish_git_project_dir)
-    set -l hg_root_dir (__bobthefish_hg_project_dir)
+  echo -n (echo "$pwd" | sed -e $expr)(__batman_color_off)
 
-    if [ "$git_root_dir" -a "$hg_root_dir" ]
-        # only show the closest parent
-        switch $git_root_dir
-            case $hg_root_dir\*
-                __bobthefish_prompt_git $git_root_dir
-            case \*
-                __bobthefish_prompt_hg $hg_root_dir
-        end
-    else if [ "$git_root_dir" ]
-        __bobthefish_prompt_git $git_root_dir
-    else if [ "$hg_root_dir" ]
-        __bobthefish_prompt_hg $hg_root_dir
-    else
-        __bobthefish_prompt_dir
-    end
+  for color in $colors
+    echo -n (set_color $color)">"
+  end
 
-    __bobthefish_finish_segments
+  echo -n " "
 end

+ 35 - 67
fish/.config/fish/functions/fish_right_prompt.fish

@@ -1,75 +1,43 @@
-# You can override some default right prompt options in your config.fish:
-#     set -g theme_date_format "+%a %H:%M"
-
-function __bobthefish_cmd_duration -S -d 'Show command duration'
-    [ "$theme_display_cmd_duration" = "no" ]
-    and return
-
-    [ -z "$CMD_DURATION" -o "$CMD_DURATION" -lt 100 ]
-    and return
-
-    if [ "$CMD_DURATION" -lt 5000 ]
-        echo -ns $CMD_DURATION 'ms'
-    else if [ "$CMD_DURATION" -lt 60000 ]
-        __bobthefish_pretty_ms $CMD_DURATION s
-    else if [ "$CMD_DURATION" -lt 3600000 ]
-        set_color $fish_color_error
-        __bobthefish_pretty_ms $CMD_DURATION m
-    else
-        set_color $fish_color_error
-        __bobthefish_pretty_ms $CMD_DURATION h
-    end
-
-    set_color $fish_color_normal
-    set_color $fish_color_autosuggestion
-
-    [ "$theme_display_date" = "no" ]
-    or echo -ns ' ' $__bobthefish_left_arrow_glyph
+function git::is_stashed
+  command git rev-parse --verify --quiet refs/stash >/dev/null
 end
 
-function __bobthefish_pretty_ms -S -a ms interval -d 'Millisecond formatting for humans'
-    set -l interval_ms
-    set -l scale 1
-
-    switch $interval
-        case s
-            set interval_ms 1000
-        case m
-            set interval_ms 60000
-        case h
-            set interval_ms 3600000
-            set scale 2
-    end
-
-    switch $FISH_VERSION
-        # Fish 2.3 and lower doesn't know about the -s argument to math.
-        case 2.0.\* 2.1.\* 2.2.\* 2.3.\*
-            math "scale=$scale;$ms/$interval_ms" | string replace -r '\\.?0*$' $interval
-        case \*
-            math -s$scale "$ms/$interval_ms" | string replace -r '\\.?0*$' $interval
-    end
+function git::get_ahead_count
+  echo (command git log 2> /dev/null | grep '^commit' | wc -l | tr -d " ")
 end
 
-function __bobthefish_timestamp -S -d 'Show the current timestamp'
-    [ "$theme_display_date" = "no" ]
-    and return
-
-    set -q theme_date_format
-    or set -l theme_date_format "+%c"
-
-    echo -n ' '
-    date $theme_date_format
+function git::branch_name
+  command git symbolic-ref --short HEAD
 end
 
-function fish_right_prompt -d 'bobthefish is all about the right prompt'
-    set -l __bobthefish_left_arrow_glyph \uE0B3
-    if [ "$theme_powerline_fonts" = "no" ]
-        set __bobthefish_left_arrow_glyph '<'
-    end
-
-    set_color $fish_color_autosuggestion
+function git::is_touched
+  test -n (echo (command git status --porcelain))
+end
 
-    __bobthefish_cmd_duration
-    __bobthefish_timestamp
-    set_color normal
+function fish_right_prompt
+  set -l code $status
+  test $code -ne 0; and echo (__batman_color_dim)"("(__batman_color_trd)"$code"(__batman_color_dim)") "(__batman_color_off)
+
+  if test -n "$SSH_CONNECTION"
+     printf (__batman_color_trd)":"(__batman_color_dim)"$HOSTNAME "(__batman_color_off)
+   end
+
+  if git rev-parse 2> /dev/null
+    git::is_stashed; and echo (__batman_color_trd)"^"(__batman_color_off)
+    printf (__batman_color_snd)"("(begin
+      if git::is_touched
+        echo (__batman_color_trd)"*"(__batman_color_off)
+      else
+        echo ""
+      end
+    end)(__batman_color_fst)(git::branch_name)(__batman_color_snd)(begin
+      set -l count (git::get_ahead_count)
+        if test $count -eq 0
+          echo ""
+        else
+          echo (__batman_color_trd)"+"(__batman_color_fst)$count
+        end
+    end)(__batman_color_snd)") "(__batman_color_off)
+  end
+  printf (__batman_color_dim)(date +%H(__batman_color_fst):(__batman_color_dim)%M(__batman_color_fst):(__batman_color_dim)%S)(__batman_color_off)" "
 end

+ 2 - 33
fish/.config/fish/functions/fish_title.fish

@@ -1,34 +1,3 @@
-# You can override some default title options in your config.fish:
-#     set -g theme_title_display_process no
-#     set -g theme_title_display_path no
-#     set -g theme_title_display_user yes
-#     set -g theme_title_use_abbreviated_path no
-
-function __bobthefish_title_user -S -d 'Display actual user if different from $default_user'
-    if [ "$theme_title_display_user" = 'yes' ]
-        if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ]
-            set -l IFS .
-            hostname | read -l hostname __
-            echo -ns (whoami) '@' $hostname ' '
-        end
-    end
-end
-
 function fish_title
-    __bobthefish_title_user
-
-    if [ "$theme_title_display_process" = 'yes' ]
-        echo $_
-
-        [ "$theme_title_display_path" != 'no' ]
-        and echo ' '
-    end
-
-    if [ "$theme_title_display_path" != 'no' ]
-        if [ "$theme_title_use_abbreviated_path" = 'no' ]
-            echo $PWD
-        else
-            prompt_pwd
-        end
-    end
-end
+  echo "$PWD | $_" | sed "s|$HOME|~|g"
+end

+ 0 - 3
fish/.config/fish/functions/s.fish

@@ -1,3 +0,0 @@
-function s -d "Interactively select from all"
-  fasd -is $argv
-end

+ 0 - 3
fish/.config/fish/functions/sd.fish

@@ -1,3 +0,0 @@
-function sd -d "Interactively select directory"
-  fasd -isd $argv
-end

+ 0 - 3
fish/.config/fish/functions/sf.fish

@@ -1,3 +0,0 @@
-function sf -d "Interactively select file"
-  fasd -isf $argv
-end

+ 0 - 3
fish/.config/fish/functions/z.fish

@@ -1,3 +0,0 @@
-function z -d "Change directory to first match"
-  fasd_cd -d $argv
-end

+ 0 - 3
fish/.config/fish/functions/zz.fish

@@ -1,3 +0,0 @@
-function zz -d "Change directory with interactive selection"
-  fasd_cd -id $argv
-end