Przeglądaj źródła

Use pure theme for #fishshell

Colin Powell 6 lat temu
rodzic
commit
224697d780
55 zmienionych plików z 911 dodań i 1318 usunięć
  1. 31 0
      fish/.config/fish/conf.d/.gitnow
  2. 8 0
      fish/.config/fish/conf.d/_pure_init.fish
  3. 138 0
      fish/.config/fish/conf.d/done.fish
  4. 238 0
      fish/.config/fish/conf.d/gitnow.fish
  5. 16 0
      fish/.config/fish/conf.d/gitnow_config.fish
  6. 65 0
      fish/.config/fish/conf.d/pure.fish
  7. 1 0
      fish/.config/fish/config.fish
  8. 2 0
      fish/.config/fish/fish_variables
  9. 4 1
      fish/.config/fish/fishfile
  10. 32 0
      fish/.config/fish/functions/_pure_format_time.fish
  11. 14 0
      fish/.config/fish/functions/_pure_get_prompt_symbol.fish
  12. 14 0
      fish/.config/fish/functions/_pure_parse_directory.fish
  13. 4 0
      fish/.config/fish/functions/_pure_parse_git_branch.fish
  14. 11 0
      fish/.config/fish/functions/_pure_print_prompt.fish
  15. 10 0
      fish/.config/fish/functions/_pure_prompt.fish
  16. 6 0
      fish/.config/fish/functions/_pure_prompt_beginning.fish
  17. 11 0
      fish/.config/fish/functions/_pure_prompt_command_duration.fish
  18. 11 0
      fish/.config/fish/functions/_pure_prompt_current_folder.fish
  19. 3 0
      fish/.config/fish/functions/_pure_prompt_ending.fish
  20. 32 0
      fish/.config/fish/functions/_pure_prompt_first_line.fish
  21. 16 0
      fish/.config/fish/functions/_pure_prompt_git.fish
  22. 6 0
      fish/.config/fish/functions/_pure_prompt_git_branch.fish
  23. 12 0
      fish/.config/fish/functions/_pure_prompt_git_dirty.fish
  24. 23 0
      fish/.config/fish/functions/_pure_prompt_git_pending_commits.fish
  25. 11 0
      fish/.config/fish/functions/_pure_prompt_new_line.fish
  26. 5 0
      fish/.config/fish/functions/_pure_prompt_ssh.fish
  27. 7 0
      fish/.config/fish/functions/_pure_prompt_ssh_host.fish
  28. 6 0
      fish/.config/fish/functions/_pure_prompt_ssh_separator.fish
  29. 9 0
      fish/.config/fish/functions/_pure_prompt_ssh_user.fish
  30. 17 0
      fish/.config/fish/functions/_pure_prompt_symbol.fish
  31. 5 0
      fish/.config/fish/functions/_pure_prompt_vimode.fish
  32. 8 0
      fish/.config/fish/functions/_pure_prompt_virtualenv.fish
  33. 5 0
      fish/.config/fish/functions/_pure_set_default.fish
  34. 9 0
      fish/.config/fish/functions/_pure_string_width.fish
  35. 0 133
      fish/.config/fish/functions/bobthefish_display_colors.fish
  36. 5 0
      fish/.config/fish/functions/ffup.fish
  37. 1 9
      fish/.config/fish/functions/fish_greeting.fish
  38. 0 7
      fish/.config/fish/functions/fish_mode_prompt.fish
  39. 7 1063
      fish/.config/fish/functions/fish_prompt.fish
  40. 3 77
      fish/.config/fish/functions/fish_right_prompt.fish
  41. 10 28
      fish/.config/fish/functions/fish_title.fish
  42. 8 0
      fish/.config/fish/functions/git_ahead.fish
  43. 15 0
      fish/.config/fish/functions/git_branch_name.fish
  44. 3 0
      fish/.config/fish/functions/git_is_detached_head.fish
  45. 3 0
      fish/.config/fish/functions/git_is_dirty.fish
  46. 3 0
      fish/.config/fish/functions/git_is_empty.fish
  47. 5 0
      fish/.config/fish/functions/git_is_repo.fish
  48. 3 0
      fish/.config/fish/functions/git_is_staged.fish
  49. 3 0
      fish/.config/fish/functions/git_is_stashed.fish
  50. 3 0
      fish/.config/fish/functions/git_is_tag.fish
  51. 3 0
      fish/.config/fish/functions/git_is_touched.fish
  52. 3 0
      fish/.config/fish/functions/git_repository_root.fish
  53. 15 0
      fish/.config/fish/functions/git_untracked_files.fish
  54. 19 0
      fish/.config/fish/functions/humanize_duration.fish
  55. 9 0
      ssh/.ssh/config

+ 31 - 0
fish/.config/fish/conf.d/.gitnow

@@ -0,0 +1,31 @@
+[ keybindings ]
+
+# Alt + S
+state = \es
+
+# Alt + E
+stage = \ee
+
+# Ctrl + E
+unstage = \ce
+
+# Alt + C
+commit-all = \ec
+
+# Alt + D
+pull = \ed
+
+# Alt + P
+push = \ep
+
+# Alt + U
+upstream = \eu
+
+# Alt + L
+logs = \el
+
+# Alt + F
+feature = \ef
+
+# Alt + H
+hotfix = \eh

+ 8 - 0
fish/.config/fish/conf.d/_pure_init.fish

@@ -0,0 +1,8 @@
+# Deactivate the default virtualenv prompt so that we can add our own
+set --global --export VIRTUAL_ENV_DISABLE_PROMPT 1
+
+# Whether or not is a fresh session
+set --global _pure_fresh_session true
+
+# Register `_pure_prompt_new_line` as an event handler fot `fish_prompt`
+functions -q _pure_prompt_new_line

+ 138 - 0
fish/.config/fish/conf.d/done.fish

@@ -0,0 +1,138 @@
+# MIT License
+
+# Copyright (c) 2016 Francisco Lourenço & Daniel Wehner
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+set -g __done_version 1.8.0
+
+function __done_get_focused_window_id
+	if type -q lsappinfo
+		lsappinfo info -only bundleID (lsappinfo front) | cut -d '"' -f4
+	else if type -q xprop
+	and test $DISPLAY
+		xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2
+	end
+end
+
+function __done_is_tmux_window_active
+	set -q fish_pid; or set -l fish_pid %self
+
+	not tmux list-panes -a -F "#{session_attached} #{window_active} #{pane_pid}" | string match -q "1 0 $fish_pid"
+end
+
+function __done_is_process_window_focused
+	# Return false if the window is not focused
+	if test $__done_initial_window_id != (__done_get_focused_window_id)
+		return 1
+	end
+	# If inside a tmux session, check if the tmux window is focused
+	if type -q tmux
+	and test -n "$TMUX"
+		__done_is_tmux_window_active
+		return $status
+	end
+
+	return 0
+end
+
+
+# verify that the system has graphical capabilites before initializing
+if test -z "$SSH_CLIENT"  # not over ssh
+and test -n __done_get_focused_window_id  # is able to get window id
+
+	set -g __done_initial_window_id ''
+	set -q __done_min_cmd_duration; or set -g __done_min_cmd_duration 5000
+	set -q __done_exclude; or set -g __done_exclude 'git (?!push|pull)'
+
+	function __done_started --on-event fish_preexec
+		set __done_initial_window_id (__done_get_focused_window_id)
+	end
+
+	function __done_ended --on-event fish_prompt
+		set -l exit_status $status
+
+		# backwards compatibilty for fish < v3.0
+		set -q cmd_duration; or set -l cmd_duration $CMD_DURATION
+
+		if test $cmd_duration
+		and test $cmd_duration -gt $__done_min_cmd_duration # longer than notify_duration
+		and not __done_is_process_window_focused  # process pane or window not focused
+		and not string match -qr $__done_exclude $history[1] # don't notify on git commands which might wait external editor
+
+			# Store duration of last command
+			set -l humanized_duration (echo "$cmd_duration" | humanize_duration)
+
+			set -l title "Done in $humanized_duration"
+			set -l wd (pwd | sed "s,^$HOME,~,")
+			set -l message "$wd/ $history[1]"
+			set -l sender $__done_initial_window_id
+
+			# workarout terminal notifier bug when sending notifications from inside tmux
+			# https://github.com/julienXX/terminal-notifier/issues/216
+			if test $TMUX
+				set sender "tmux"
+			end
+
+			if test $exit_status -ne 0
+				set title "Failed ($exit_status) after $humanized_duration"
+			end
+
+			if set -q __done_notification_command
+				eval $__done_notification_command
+			else if type -q terminal-notifier  # https://github.com/julienXX/terminal-notifier
+				terminal-notifier -message "$message" -title "$title" -sender "$sender" -activate "$__done_initial_window_id"
+
+			else if type -q osascript  # AppleScript
+				osascript -e "display notification \"$message\" with title \"$title\""
+
+			else if type -q notify-send # Linux notify-send
+				set -l urgency
+				if test $exit_status -ne 0
+					set urgency "--urgency=critical"
+				end
+				notify-send $urgency --icon=terminal --app-name=fish "$title" "$message"
+
+			else if type -q notify-desktop # Linux notify-desktop
+				set -l urgency
+				if test $exit_status -ne 0
+					set urgency "--urgency=critical"
+				end
+				notify-desktop $urgency --icon=terminal --app-name=fish "$title" "$message"
+
+			else  # anything else
+				echo -e "\a" # bell sound
+			end
+
+		end
+	end
+end
+
+function __done_uninstall -e done_uninstall
+  # Erase all __done_* functions
+  functions -e __done_ended
+  functions -e __done_started
+  functions -e __done_get_focused_window_id
+  functions -e __done_is_tmux_window_active
+  functions -e __done_is_process_window_focused
+
+  # Erase __done variables
+  set -e __done_version
+end
+

+ 238 - 0
fish/.config/fish/conf.d/gitnow.fish

@@ -0,0 +1,238 @@
+# GitNow — Speed up your Git workflow. 🐠
+# https://github.com/joseluisq/gitnow
+
+function gitnow -d "Gitnow: Speed up your Git workflow. 🐠" -a xversion
+  if [ "$xversion" = "-v" ]; or [ "$xversion" = "--version" ]
+    echo "GitNow version $gitnow_version"
+  else
+    __gitnow_manual | command less -r
+    commandline -f repaint;
+  end
+end
+
+function state -d "Gitnow: Show the working tree status in compact way"
+  if not __gitnow_is_git_repository; __gitnow_msg_not_valid_repository "state"; return; end
+
+  command git status -sb
+  commandline -f repaint;
+end
+
+function stage -d "Gitnow: Stage files in current working directory"
+  if not __gitnow_is_git_repository; __gitnow_msg_not_valid_repository "stage"; return; end
+
+  set -l len (count $argv)
+  set -l opts .
+
+  if test $len -gt 0
+    set opts $argv
+  end
+
+  command git add $opts
+  commandline -f repaint;
+end
+
+function unstage -d "Gitnow: Unstage files in current working directory"
+  if not __gitnow_is_git_repository; __gitnow_msg_not_valid_repository "unstage"; return; end
+
+  set -l len (count $argv)
+  set -l opts .
+
+  if test $len -gt 0
+    set opts $argv
+  end
+
+  command git reset $opts
+  commandline -f repaint;
+end
+
+function commit -d "Gitnow: Commit changes to the repository"
+  if not __gitnow_is_git_repository; __gitnow_msg_not_valid_repository "commit"; return; end
+
+  set -l len (count $argv)
+
+  if test $len -gt 0
+    command git commit $argv
+  else
+    command git commit
+  end
+
+  commandline -f repaint;
+end
+
+function commit-all -d "Gitnow: Add and commit all changes to the repository"
+  if not __gitnow_is_git_repository; __gitnow_msg_not_valid_repository "commit-all"; return; end
+
+  stage
+  commit .
+end
+
+function pull -d "Gitnow: Pull changes from remote server but saving uncommitted changes"
+  if not __gitnow_is_git_repository; __gitnow_msg_not_valid_repository "pull"; return; end
+
+  set -l len (count $argv)
+  set -l xorigin (__gitnow_current_remote)
+  set -l xbranch (__gitnow_current_branch_name)
+  set -l xcmd ""
+  
+  echo "⚡️ Pulling changes..."
+
+  set -l xdefaults --rebase --autostash
+
+  if test $len -gt 2 
+    set xcmd $argv
+
+    echo "Mode: Manual"
+    echo "Default flags: $xdefaults"
+    echo
+  else
+    echo "Mode: Auto"
+    echo "Default flags: $xdefaults"
+
+    if test $len -eq 1
+      set xbranch $argv[1]
+    end
+
+    if test $len -eq 2
+      set xorigin $argv[1]
+      set xbranch $argv[2]
+    end
+
+    set xcmd $xorigin $xbranch
+    set -l xremote_url (command git config --get "remote.$xorigin.url")
+
+    echo "Remote URL: $xorigin ($xremote_url)"
+    echo "Remote branch: $xbranch"
+    echo
+  end
+
+  command git pull $xcmd $xdefaults
+  commandline -f repaint;
+end
+
+# Git push with --set-upstream
+# Shortcut inspired from https://github.com/jamiew/git-friendly
+function push -d "Gitnow: Push commit changes to remote repository"
+  if not __gitnow_is_git_repository; __gitnow_msg_not_valid_repository "push"; return; end
+
+  set -l opts $argv
+  set -l xorigin (__gitnow_current_remote)
+  set -l xbranch (__gitnow_current_branch_name)
+
+  echo "🚀 Pushing changes..."
+
+  if test (count $opts) -eq 0
+    set opts $xorigin $xbranch
+    set -l xremote_url (command git config --get "remote.$xorigin.url")
+
+    echo "Mode: Auto"
+    echo "Remote URL: $xorigin ($xremote_url)"
+    echo "Remote branch: $xbranch"
+  else
+    echo "Mode: Manual"
+  end
+
+  echo
+
+  command git push --set-upstream $opts
+  commandline -f repaint;
+end
+
+function upstream -d "Gitnow: Commit all changes and push them to remote server"
+  if not __gitnow_is_git_repository; __gitnow_msg_not_valid_repository "upstream"; return; end
+
+  commit-all
+  push
+end
+
+function feature -d "GitNow: Creates a new Gitflow feature branch from current branch" -a xbranch
+  if not __gitnow_is_git_repository; __gitnow_msg_not_valid_repository "feature"; return; end
+
+  __gitnow_gitflow_branch "feature" $xbranch
+  commandline -f repaint;
+end
+
+function hotfix -d "GitNow: Creates a new Gitflow hotfix branch from current branch" -a xbranch
+  if not __gitnow_is_git_repository; __gitnow_msg_not_valid_repository "hotfix"; return; end
+
+  __gitnow_gitflow_branch "hotfix" $xbranch
+  commandline -f repaint;
+end
+
+function bugfix -d "GitNow: Creates a new Gitflow bugfix branch from current branch" -a xbranch
+  if not __gitnow_is_git_repository; __gitnow_msg_not_valid_repository "bugfix"; return; end
+
+  __gitnow_gitflow_branch "bugfix" $xbranch
+  commandline -f repaint;
+end
+
+function release -d "GitNow: Creates a new Gitflow release branch from current branch" -a xbranch
+  if not __gitnow_is_git_repository; __gitnow_msg_not_valid_repository "release"; return; end
+
+  __gitnow_gitflow_branch "release" $xbranch
+  commandline -f repaint;
+end
+
+function move -d "GitNow: Switch from current branch to another but stashing uncommitted changes" -a xupstream -a xbranch
+  if not __gitnow_is_git_repository; __gitnow_msg_not_valid_repository "move"; return; end
+
+  if [ "$xupstream" != "-u" ]; and [ "$xupstream" != "--upstream" ]
+    set xbranch $xupstream
+    set xupstream ""
+  end
+
+  if test -n "$xbranch"
+    if [ "$xupstream" = "-u" ]; or [ "$xupstream" = "--upstream" ]
+      command git stash
+      command git fetch (__gitnow_current_remote) $xbranch
+      command git checkout $xbranch
+      command git stash pop
+    else
+      set -l xfound (__gitnow_check_if_branch_exist $xbranch)
+
+      if test $xfound -eq 1
+        if [ "$xbranch" = (__gitnow_current_branch_name) ]
+          echo "Branch `$xbranch` is the same like current branch. Nothing to do."
+        else
+          command git stash
+          command git checkout $xbranch
+          command git stash pop
+        end
+      else
+        echo "Branch `$xbranch` was not found. No possible to switch."
+        echo "Tip: Use -u (--upstream) flag to fetch a remote branch."
+      end
+    end
+  else
+    echo "Provide a branch name to move."
+  end
+
+  commandline -f repaint;
+end
+
+function logs -d "Gitnow: Shows logs in a fancy way"
+  if not __gitnow_is_git_repository; __gitnow_msg_not_valid_repository "logs"; return; end
+
+  set -l args HEAD
+
+  if test -n "$argv"
+    set args $argv
+  end
+
+  command git log $args --color --graph --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit | command less -r
+
+  commandline -f repaint;
+end
+
+function github -d "Gitnow: Clone a GitHub repository using SSH"
+  set -l repo (__gitnow_clone_params $argv)
+  __gitnow_clone_repo $repo "github"
+
+  commandline -f repaint;
+end
+
+function bitbucket -d "Gitnow: Clone a Bitbucket Cloud repository using SSH"
+  set -l repo (__gitnow_clone_params $argv)
+  __gitnow_clone_repo $repo "bitbucket"
+
+  commandline -f repaint;
+end

+ 16 - 0
fish/.config/fish/conf.d/gitnow_config.fish

@@ -0,0 +1,16 @@
+# GitNow — Speed up your Git workflow. 🐠
+# https://github.com/joseluisq/gitnow
+
+set -q XDG_CONFIG_HOME; or set XDG_CONFIG_HOME ~/.config
+set -q fish_config; or set -g fish_config $XDG_CONFIG_HOME/fish
+set -q fish_snippets; or set -g fish_snippets "$fish_config/conf.d"
+set -q fish_functions; or set -g fish_functions "$fish_config/functions"
+set -q GITNOW_CONFIG_FILE; or set -g GITNOW_CONFIG_FILE ~/.gitnow
+
+set -g gitnow_version 2.1.1
+
+source "$fish_functions/__gitnow_functions.fish"
+source "$fish_functions/__gitnow_manual.fish"
+source "$fish_functions/__gitnow_config_file.fish"
+
+__gitnow_read_config

+ 65 - 0
fish/.config/fish/conf.d/pure.fish

@@ -0,0 +1,65 @@
+set --universal pure_version 2.1.8 # used for bug report
+
+# Base colors
+_pure_set_default pure_color_primary (set_color blue)
+_pure_set_default pure_color_info (set_color cyan)
+_pure_set_default pure_color_mute (set_color brblack)
+_pure_set_default pure_color_success (set_color magenta)
+_pure_set_default pure_color_normal (set_color normal)
+_pure_set_default pure_color_danger (set_color red)
+_pure_set_default pure_color_light (set_color white)
+_pure_set_default pure_color_warning (set_color yellow)
+_pure_set_default pure_color_dark (set_color black)
+
+# Prompt
+_pure_set_default pure_symbol_prompt "❯"
+_pure_set_default pure_symbol_reverse_prompt "❮"  # used for VI mode
+_pure_set_default pure_color_prompt_on_error $pure_color_danger
+_pure_set_default pure_color_prompt_on_success $pure_color_success
+
+# Current Working Directory
+_pure_set_default pure_color_current_directory $pure_color_primary
+
+# Git
+_pure_set_default pure_symbol_git_unpulled_commits "⇣"
+_pure_set_default pure_symbol_git_unpushed_commits "⇡"
+_pure_set_default pure_symbol_git_dirty "*"
+_pure_set_default pure_color_git_unpulled_commits $pure_color_info
+_pure_set_default pure_color_git_unpushed_commits $pure_color_info
+_pure_set_default pure_color_git_branch $pure_color_mute
+_pure_set_default pure_color_git_dirty $pure_color_mute
+
+# SSH info
+_pure_set_default pure_color_ssh_hostname $pure_color_mute
+_pure_set_default pure_color_ssh_separator $pure_color_mute
+_pure_set_default pure_color_ssh_user_normal $pure_color_mute
+_pure_set_default pure_color_ssh_user_root $pure_color_light
+
+# Virtualenv for Pyhon
+_pure_set_default pure_color_virtualenv $pure_color_mute
+
+# Print current working directory at the beginning of prompt
+# true (default):   current directory, git, user@hostname (ssh-only), command duration
+# false:            user@hostname (ssh-only), current directory, git, command duration
+_pure_set_default pure_begin_prompt_with_current_directory true
+
+# Show exit code of last command as a separate prompt character (cf. https://github.com/sindresorhus/pure/wiki#show-exit-code-of-last-command-as-a-separate-prompt-character)
+# false - single prompt character, default
+# true - separate prompt character
+_pure_set_default pure_separate_prompt_on_error false
+
+# Max execution time of a process before its run time is shown when it exits
+_pure_set_default pure_threshold_command_duration 5
+_pure_set_default pure_color_command_duration $pure_color_warning
+
+# Right Prompt variables
+_pure_set_default pure_right_prompt ""
+_pure_set_default pure_color_right_prompt $pure_color_normal
+
+# VI mode indicator
+# true (default):  indicate a non-insert mode by reversing the prompt symbol (❮)
+# false:           indicate vi mode with [I], [N], [V]
+_pure_set_default pure_reverse_prompt_symbol_in_vimode true
+
+# Title
+_pure_set_default pure_symbol_title_bar_separator "—"

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

@@ -3,4 +3,5 @@ set -gx PATH ~/.fzf/bin $PATH
 fzf_key_bindings
 set -gx PATH ~/.asdf/installs/rust/1.36.0/bin $PATH
 set -gx PATH ~/.emacs.d/bin $PATH
+set -gx EDITOR vim $EDITOR
 eval (python -m virtualfish)

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

@@ -8,6 +8,7 @@ SETUVAR FZF_TMUX_HEIGHT:40\x25
 SETUVAR --export TERM:screen\x2d256color
 SETUVAR THEME_EDEN_PROMPT_CHAR:\u00bb
 SETUVAR Z_DATA_DIR:/Users/colinpowell/\x2elocal/share/z
+SETUVAR __done_min_cmd_duration:5000
 SETUVAR __fish_init_2_39_8:\x1d
 SETUVAR __fish_init_2_3_0:\x1d
 SETUVAR __fish_init_3_x:\x1d
@@ -41,3 +42,4 @@ SETUVAR fish_pager_color_description:B3A06D\x1eyellow
 SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
 SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
 SETUVAR fish_user_paths:/Users/colinpowell/\x2efzf/bin
+SETUVAR pure_version:2\x2e1\x2e8

+ 4 - 1
fish/.config/fish/fishfile

@@ -2,4 +2,7 @@ edc/bass
 jethrokuan/fzf
 2m/fish-gpg-tty
 oh-my-fish/plugin-direnv
-oh-my-fish/theme-bobthefish
+joseluisq/gitnow
+fishpkg/fish-git-util
+rafaelrinaldi/pure
+franciscolourenco/done

+ 32 - 0
fish/.config/fish/functions/_pure_format_time.fish

@@ -0,0 +1,32 @@
+set fail 1
+
+function _pure_format_time \
+    --description="Format milliseconds to a human readable format" \
+    --argument-names milliseconds threshold
+    
+    if test $milliseconds -lt 0; return $fail; end
+
+    set --local seconds (math -s0 "$milliseconds / 1000 % 60")
+    set --local minutes (math -s0 "$milliseconds / 60000 % 60")
+    set --local hours (math -s0 "$milliseconds / 3600000 % 24")
+    set --local days (math -s0 "$milliseconds / 86400000")
+    set --local time
+
+    if test $days -gt 0
+        set time $time (printf "%sd" $days)
+    end
+
+    if test $hours -gt 0
+        set time $time (printf "%sh" $hours)
+    end
+
+    if test $minutes -gt 0
+        set time $time (printf "%sm" $minutes)
+    end
+
+    if test $seconds -gt $threshold
+        set time $time (printf "%ss" $seconds)
+    end
+
+    echo -e (string join ' ' $time)
+end

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

@@ -0,0 +1,14 @@
+function _pure_get_prompt_symbol \
+    --description 'Print prompt symbol' \
+    --argument-names exit_code
+
+    set --local prompt_symbol $pure_symbol_prompt
+    set --local is_vi_mode (string match -r "fish_(vi|hybrid)_key_bindings" $fish_key_bindings)
+    if test -n "$is_vi_mode" \
+            -a "$pure_reverse_prompt_symbol_in_vimode" = true \
+            -a "$fish_bind_mode" != "insert"
+        set prompt_symbol $pure_symbol_reverse_prompt
+    end
+
+    echo "$prompt_symbol"
+end

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

@@ -0,0 +1,14 @@
+function _pure_parse_directory \
+    --description "Replace '$HOME' with '~'" \
+    --argument-names max_path_length
+
+    set --local folder (string replace $HOME '~' $PWD)
+    
+    if test -n "$max_path_length";
+        if test (string length $folder) -gt $max_path_length;
+            # If path exceeds maximum symbol limit, use default fish path formating function
+            set folder (prompt_pwd)
+        end
+    end
+    echo $folder
+end

+ 4 - 0
fish/.config/fish/functions/_pure_parse_git_branch.fish

@@ -0,0 +1,4 @@
+function _pure_parse_git_branch --description "Parse current Git branch name"
+    command git symbolic-ref --short HEAD 2>/dev/null;
+        or echo (command git show-ref --head -s --abbrev HEAD)[1]
+end

+ 11 - 0
fish/.config/fish/functions/_pure_print_prompt.fish

@@ -0,0 +1,11 @@
+function _pure_print_prompt
+    set --local prompt
+    
+    for prompt_part in $argv
+        if test (_pure_string_width $prompt_part) -gt 0
+            set prompt "$prompt $prompt_part"
+        end
+    end
+
+    echo (string trim -l $prompt)
+end

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

@@ -0,0 +1,10 @@
+function _pure_prompt \
+    --description 'Print prompt symbol' \
+    --argument-names exit_code
+
+    set --local virtualenv (_pure_prompt_virtualenv) # Python virtualenv name
+    set --local vimode_indicator (_pure_prompt_vimode) # vi-mode indicator
+    set --local pure_symbol (_pure_prompt_symbol $exit_code)
+
+    echo (_pure_print_prompt $virtualenv $vimode_indicator $pure_symbol)
+end

+ 6 - 0
fish/.config/fish/functions/_pure_prompt_beginning.fish

@@ -0,0 +1,6 @@
+function _pure_prompt_beginning
+    # Clear existing line content
+    set --local clear_line "\r\033[K"
+
+    echo $clear_line
+end

+ 11 - 0
fish/.config/fish/functions/_pure_prompt_command_duration.fish

@@ -0,0 +1,11 @@
+function _pure_prompt_command_duration
+    set --local command_duration
+
+    # Get command execution duration
+    if test -n "$CMD_DURATION"
+        set command_duration (_pure_format_time $CMD_DURATION $pure_threshold_command_duration)
+    end
+    set --local command_duration_color "$pure_color_command_duration"
+
+    echo "$command_duration_color$command_duration"
+end

+ 11 - 0
fish/.config/fish/functions/_pure_prompt_current_folder.fish

@@ -0,0 +1,11 @@
+set fail 1
+
+function _pure_prompt_current_folder --argument-names current_prompt_width
+
+    if test -z "$current_prompt_width"; return $fail; end
+
+    set --local current_folder (_pure_parse_directory (math $COLUMNS - $current_prompt_width - 1))
+    set --local current_folder_color "$pure_color_current_directory"
+
+    echo "$current_folder_color$current_folder"
+end

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

@@ -0,0 +1,3 @@
+function _pure_prompt_ending
+    echo "$pure_color_normal "
+end

+ 32 - 0
fish/.config/fish/functions/_pure_prompt_first_line.fish

@@ -0,0 +1,32 @@
+function _pure_prompt_first_line \
+    --description 'Print contextual information before prompt.'
+
+    if not type -fq git  # exit if git is not available
+        return 1
+    end
+
+    set --local prompt (_pure_print_prompt \
+                            (_pure_prompt_ssh) \
+                            (_pure_prompt_git) \
+                            (_pure_prompt_command_duration)
+                        )
+    set --local prompt_width (_pure_string_width $prompt)
+    set --local current_folder (_pure_prompt_current_folder $prompt_width)
+
+    set --local prompt_components
+    if test $pure_begin_prompt_with_current_directory = true
+        set prompt_components \
+                (_pure_prompt_current_folder $prompt_width) \
+                (_pure_prompt_git) \
+                (_pure_prompt_ssh) \
+                (_pure_prompt_command_duration)
+    else
+        set prompt_components \
+                (_pure_prompt_ssh) \
+                (_pure_prompt_current_folder $prompt_width) \
+                (_pure_prompt_git) \
+                (_pure_prompt_command_duration)
+    end
+
+    echo (_pure_print_prompt $prompt_components)
+end

+ 16 - 0
fish/.config/fish/functions/_pure_prompt_git.fish

@@ -0,0 +1,16 @@
+function _pure_prompt_git \
+    --description 'Print git repository informations: branch name, dirty, upstream ahead/behind'
+
+    set --local is_git_repository (command git rev-parse --is-inside-work-tree 2>/dev/null)
+
+    if test -n "$is_git_repository"
+        set --local git_prompt (_pure_prompt_git_branch)(_pure_prompt_git_dirty)
+        set --local git_pending_commits (_pure_prompt_git_pending_commits)
+
+        if test (_pure_string_width $git_pending_commits) -ne 0
+            set git_prompt $git_prompt $git_pending_commits
+        end
+
+        echo $git_prompt
+    end
+end

+ 6 - 0
fish/.config/fish/functions/_pure_prompt_git_branch.fish

@@ -0,0 +1,6 @@
+function _pure_prompt_git_branch
+    set --local git_branch (_pure_parse_git_branch) # current git branch
+    set --local git_branch_color "$pure_color_git_branch"
+
+    echo "$git_branch_color$git_branch"
+end

+ 12 - 0
fish/.config/fish/functions/_pure_prompt_git_dirty.fish

@@ -0,0 +1,12 @@
+function _pure_prompt_git_dirty
+    set --local git_dirty_symbol
+    set --local git_dirty_color
+
+    set --local is_git_dirty (command git status --porcelain --ignore-submodules 2>/dev/null)
+    if test -n "$is_git_dirty"  # untracked or un-commited files
+        set git_dirty_symbol "$pure_symbol_git_dirty"
+        set git_dirty_color "$pure_color_git_dirty"
+    end
+
+    echo "$git_dirty_color$git_dirty_symbol"
+end

+ 23 - 0
fish/.config/fish/functions/_pure_prompt_git_pending_commits.fish

@@ -0,0 +1,23 @@
+function _pure_prompt_git_pending_commits
+    set --local git_unpushed_commits
+    set --local git_unpulled_commits
+
+    set --local has_upstream (command git rev-parse --abbrev-ref '@{upstream}' 2>/dev/null)
+    if test -n "$has_upstream"  # check there is an upstream repo configured
+        and test "$has_upstream" != '@{upstream}' # Fixed #179, dont check the empty repo
+        command git rev-list --left-right --count 'HEAD...@{upstream}' \
+        | read --local --array git_status
+        set --local commit_to_push $git_status[1]
+        set --local commit_to_pull $git_status[2]
+
+        if test $commit_to_push -gt 0  # upstream is behind local repo
+            set git_unpushed_commits "$pure_color_git_unpushed_commits$pure_symbol_git_unpushed_commits"
+        end
+
+        if test $commit_to_pull -gt 0  # upstream is ahead of local repo
+            set git_unpulled_commits "$pure_color_git_unpulled_commits$pure_symbol_git_unpulled_commits"
+        end
+    end
+
+    echo "$git_unpushed_commits$git_unpulled_commits"
+end

+ 11 - 0
fish/.config/fish/functions/_pure_prompt_new_line.fish

@@ -0,0 +1,11 @@
+function _pure_prompt_new_line \
+    --description "Do not add a line break to a brand new session" \
+    --on-event fish_prompt
+
+    set --local new_line
+    if test $_pure_fresh_session = false
+        set new_line "\n"
+    end
+
+    echo -e -n "$new_line"
+end

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

@@ -0,0 +1,5 @@
+function _pure_prompt_ssh
+    if test "$SSH_CONNECTION" != ""
+        echo (_pure_prompt_ssh_user)(_pure_prompt_ssh_separator)(_pure_prompt_ssh_host)
+    end
+end

+ 7 - 0
fish/.config/fish/functions/_pure_prompt_ssh_host.fish

@@ -0,0 +1,7 @@
+function _pure_prompt_ssh_host
+    set --query --global hostname
+    or set --local hostname (hostname -s) # current host name compatible busybox
+    set --local hostname_color "$pure_color_ssh_hostname"
+
+    echo "$hostname_color$hostname"
+end

+ 6 - 0
fish/.config/fish/functions/_pure_prompt_ssh_separator.fish

@@ -0,0 +1,6 @@
+function _pure_prompt_ssh_separator
+    set --local separator_symbol "@"
+    set --local separator_symbol_color "$pure_color_ssh_separator"
+
+    echo "$separator_symbol_color$separator_symbol"
+end

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

@@ -0,0 +1,9 @@
+function _pure_prompt_ssh_user
+    set --local username (whoami) # current user name
+    set --local username_color "$pure_color_ssh_user_normal"  # default color
+    if test "$username" = "root"
+        set username_color "$pure_color_ssh_user_root" # different color for root
+    end
+
+    echo "$username_color$username"
+end

+ 17 - 0
fish/.config/fish/functions/_pure_prompt_symbol.fish

@@ -0,0 +1,17 @@
+function _pure_prompt_symbol \
+    --description 'Print prompt symbol' \
+    --argument-names exit_code
+
+    set --local prompt_symbol (_pure_get_prompt_symbol)
+    set --local command_succeed 0
+    set --local color_symbol $pure_color_prompt_on_success # default pure symbol color
+    if test $exit_code -ne $command_succeed
+        set color_symbol $pure_color_prompt_on_error  # different pure symbol color when previous command failed
+
+        if test "$pure_separate_prompt_on_error" = true
+            set color_symbol "$pure_color_prompt_on_error$prompt_symbol$pure_color_prompt_on_success"
+        end
+    end
+
+    echo "$color_symbol$prompt_symbol"
+end

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

@@ -0,0 +1,5 @@
+function _pure_prompt_vimode
+    if test $pure_reverse_prompt_symbol_in_vimode = false
+      echo (fish_default_mode_prompt)
+    end
+end

+ 8 - 0
fish/.config/fish/functions/_pure_prompt_virtualenv.fish

@@ -0,0 +1,8 @@
+function _pure_prompt_virtualenv --description "Display virtualenv directory"
+    if test -n "$VIRTUAL_ENV"
+        set --local virtualenv (basename "$VIRTUAL_ENV")
+        set --local virtualenv_color "$pure_color_virtualenv"
+
+        echo "$virtualenv_color$virtualenv"
+    end
+end

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

@@ -0,0 +1,5 @@
+function _pure_set_default -S -a var default
+    if not set -q $var
+        set -g $var $default
+    end
+end

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

@@ -0,0 +1,9 @@
+function _pure_string_width \
+    --description 'returns raw string length, i.e. ignore ANSI-color' \
+    --argument-names prompt
+
+    set --local empty ''
+    set --local raw_prompt (string replace --all --regex '\e\[[^m]*m' $empty -- $prompt)
+
+    string length -- $raw_prompt
+end

+ 0 - 133
fish/.config/fish/functions/bobthefish_display_colors.fish

@@ -1,133 +0,0 @@
-function bobthefish_display_colors -a color_scheme -d 'Print example prompt color schemes'
-
-  set -l color_schemes default light \
-    solarized solarized-light \
-    base16 base16-light \
-    gruvbox zenburn \
-    dracula \
-    terminal terminal-dark-white \
-    terminal-light terminal-light-black \
-    terminal2 terminal2-dark-white \
-    terminal2-light terminal2-light-black
-
-  switch "$color_scheme"
-    case '--all'
-      for scheme in $color_schemes
-        echo
-        echo "$scheme:"
-        bobthefish_display_colors $scheme
-      end
-      return
-
-    case $color_schemes
-      __bobthefish_colors $color_scheme
-
-    case ''
-      __bobthefish_colors $theme_color_scheme
-      type -q bobthefish_colors
-        and bobthefish_colors
-
-    case '*'
-      echo 'usage: bobthefish_display_colors [--all] [color_scheme]'
-      return
-  end
-
-  __bobthefish_glyphs
-
-  echo
-  set_color normal
-
-  __bobthefish_start_segment $color_initial_segment_exit
-  echo -n exit $nonzero_exit_glyph
-  set_color -b $color_initial_segment_su
-  echo -n su $superuser_glyph
-  set_color -b $color_initial_segment_jobs
-  echo -n jobs $bg_job_glyph
-  __bobthefish_finish_segments
-  set_color normal
-  echo -n "(<- initial_segment)"
-  echo
-
-  __bobthefish_start_segment $color_path
-  echo -n /color/path/
-  set_color -b $color_path_basename
-  echo -ns basename ' '
-  __bobthefish_finish_segments
-  echo
-
-  __bobthefish_start_segment $color_path_nowrite
-  echo -n /color/path/nowrite/
-  set_color -b $color_path_nowrite_basename
-  echo -ns basename ' '
-  __bobthefish_finish_segments
-  echo
-
-  __bobthefish_start_segment $color_path
-  echo -n /color/path/
-  set_color -b $color_path_basename
-  echo -ns basename ' '
-  __bobthefish_start_segment $color_repo
-  echo -n "$branch_glyph repo $git_stashed_glyph "
-  __bobthefish_finish_segments
-  echo
-
-  __bobthefish_start_segment $color_path
-  echo -n /color/path/
-  set_color -b $color_path_basename
-  echo -ns basename ' '
-  __bobthefish_start_segment $color_repo_dirty
-  echo -n "$tag_glyph repo_dirty $git_dirty_glyph "
-  __bobthefish_finish_segments
-  echo
-
-  __bobthefish_start_segment $color_path
-  echo -n /color/path/
-  set_color -b $color_path_basename
-  echo -ns basename ' '
-  __bobthefish_start_segment $color_repo_staged
-  echo -n "$detached_glyph repo_staged $git_staged_glyph "
-  __bobthefish_finish_segments
-  echo
-
-  __bobthefish_start_segment $color_vi_mode_default
-  echo -ns vi_mode_default ' '
-  __bobthefish_finish_segments
-  __bobthefish_start_segment $color_vi_mode_insert
-  echo -ns vi_mode_insert ' '
-  __bobthefish_finish_segments
-  __bobthefish_start_segment $color_vi_mode_visual
-  echo -ns vi_mode_visual ' '
-  __bobthefish_finish_segments
-  echo
-
-  __bobthefish_start_segment $color_vagrant
-  echo -ns $vagrant_running_glyph ' ' vagrant ' '
-  __bobthefish_finish_segments
-  echo
-
-  __bobthefish_start_segment $color_username
-  echo -n username
-  set_color normal
-  set_color -b $color_hostname[1] $color_hostname[2..-1]
-  echo -ns @hostname ' '
-  __bobthefish_finish_segments
-  echo
-
-  __bobthefish_start_segment $color_rvm
-  echo -ns $ruby_glyph rvm ' '
-  __bobthefish_finish_segments
-
-  __bobthefish_start_segment $color_virtualfish
-  echo -ns $virtualenv_glyph virtualfish ' '
-  __bobthefish_finish_segments
-
-  __bobthefish_start_segment $color_virtualgo
-  echo -ns $go_glyph virtualgo ' '
-  __bobthefish_finish_segments
-
-  __bobthefish_start_segment $color_desk
-  echo -ns $desk_glyph desk ' '
-  __bobthefish_finish_segments
-
-  echo -e "\n"
-end

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

@@ -0,0 +1,5 @@
+function ffup
+	pushd ~/src/ff/fifteen5
+	docker-compose up -d
+	popd
+end

+ 1 - 9
fish/.config/fish/functions/fish_greeting.fish

@@ -1,10 +1,2 @@
-function fish_greeting -d "What's up, fish?"
-    set_color $fish_color_autosuggestion
-    uname -nmsr
-
-    # TODO: `command -q -s` only works on fish 2.5+, so hold off on that for now
-    command -s uptime >/dev/null
-    and uptime
-
-    set_color normal
+function fish_greeting
 end

+ 0 - 7
fish/.config/fish/functions/fish_mode_prompt.fish

@@ -1,9 +1,2 @@
-# This is handled inside fish_mode_prompt (see `__bobthefish_prompt_vi`)
-#
-# If you want to override this with your own mode prompt, disable bobthefish's
-# built-in mode prompt in your fish config:
-#
-#     set -g theme_display_vi no
-
 function fish_mode_prompt
 end

+ 7 - 1063
fish/.config/fish/functions/fish_prompt.fish

@@ -1,1066 +1,10 @@
-# 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_stashed_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_display_nvm yes
-#     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
+    set --local exit_code $status  # save previous exit code
 
+    echo -e -n (_pure_prompt_beginning)  # init prompt context (clear current line, etc.)
+    echo -e (_pure_prompt_first_line)  # print current path, git branch/status, command duration
+    echo -e -n (_pure_prompt $exit_code)  # print prompt
+    echo -e (_pure_prompt_ending)  # reset colors and end prompt
 
-# ==============================
-# Helper methods
-# ==============================
-
-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_pwd -d 'Get a normalized $PWD'
-    # The pwd builtin accepts `-P` on at least Fish 3.x, but fall back to $PWD if that doesn't work
-    builtin pwd -P 2>/dev/null
-    or echo $PWD
-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
-
-        # truncate the middle of the branch name, but only if it's 25+ characters
-        set -l truncname (string replace -r '^(.{28}).{3,}(.{5})$' "\$1…\$2" $ref)
-
-        string replace -r '^refs/heads/' "$branch_glyph " $truncname
-        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 -a real_pwd -d 'Check whether the current directory should be ignored as a VCS segment'
-    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 -a real_pwd -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 $real_pwd) ]
-    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 $real_pwd/
-            case $git_toplevel/\*
-                echo $git_toplevel
-                return
-        end
-
-        # Otherwise, we need to find the equivalent directory in the $PWD
-        set -l d $real_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 $real_pwd
-    popd
-
-    switch $real_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 $real_pwd/
-        case $project_dir/\*
-            echo $project_dir
-            return
-    end
-
-    set project_dir (command git rev-parse --show-toplevel 2>/dev/null)
-    switch $real_pwd/
-        case $project_dir/\*
-            echo $project_dir
-    end
-end
-
-function __bobthefish_hg_project_dir -S -a real_pwd -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 $real_pwd) ]
-    and return
-
-    set -l d $real_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 -a real_pwd -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"'($|/)' '' $real_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
-
-function __bobthefish_git_stashed -S -d 'Print the stashed state for the current branch'
-    if [ "$theme_display_git_stashed_verbose" = 'yes' ]
-        set -l stashed (command git rev-list --walk-reflogs --count refs/stash 2>/dev/null)
-        or return
-
-        echo -n "$git_stashed_glyph$stashed"
-    else
-        command git rev-parse --verify --quiet refs/stash >/dev/null
-        and echo -n "$git_stashed_glyph"
-    end
-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 set -q theme_newline_prompt
-            echo -ens "$theme_newline_prompt"
-        else 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_k8s_context -S -d 'Get the current k8s context'
-    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 1
-
-                echo $context
-                return
-            end
-        end <$file
-    end
-
-    return 1
-end
-
-function __bobthefish_k8s_namespace -S -d 'Get the current k8s namespace'
-    kubectl config view --minify --output "jsonpath={..namespace}"
-end
-
-function __bobthefish_prompt_k8s_context -S -d 'Show current Kubernetes context'
-    [ "$theme_display_k8s_context" = 'yes' ]
-    or return
-
-    set -l context (__bobthefish_k8s_context)
-    or return
-
-    set -l namespace (__bobthefish_k8s_namespace)
-
-    set -l segment $k8s_glyph " " $context
-    [ -n "$namespace" ]
-    and set segment $segment ":" $namespace
-
-    __bobthefish_start_segment $color_k8s
-    echo -ns $segment " "
-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 -a 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
-
-function __bobthefish_prompt_nvm -S -d 'Display current node version through NVM'
-    [ "$theme_display_nvm" = 'yes' -a -n "$NVM_DIR" ]
-    or return
-
-    set -l node_version (nvm current 2> /dev/null)
-
-    [ -z $node_version -o "$node_version" = 'none' -o "$node_version" = 'system' ]
-    and return
-
-    __bobthefish_start_segment $color_nvm
-    echo -ns $node_glyph $node_version ' '
-    set_color normal
-end
-
-
-# ==============================
-# VCS segments
-# ==============================
-
-function __bobthefish_prompt_hg -S -a hg_root_dir -a real_pwd -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 $real_pwd)
-    if [ "$project_pwd" ]
-        if [ -w "$real_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 -a real_pwd -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 (__bobthefish_git_stashed)
-    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 $real_pwd)
-        if [ "$project_pwd" ]
-            if [ -w "$real_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 $real_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 "$real_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 $real_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 "$real_pwd" ]
-                set colors $color_path_nowrite
-            end
-
-            __bobthefish_start_segment $colors
-
-            echo -ns $project_pwd ' '
-        end
-    end
-end
-
-function __bobthefish_prompt_dir -S -a real_pwd -d 'Display a shortened form of the current directory'
-    __bobthefish_path_segment "$real_pwd"
-end
-
-
-# ==============================
-# Apply theme
-# ==============================
-
-function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
-    # Save the last status for later (do this before anything else)
-    set -l last_status $status
-
-    # Use a simple prompt on dumb terminals.
-    if [ "$TERM" = "dumb" ]
-        echo "> "
-        return
-    end
-
-    __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
-    __bobthefish_prompt_nvm
-
-    set -l real_pwd (__bobthefish_pwd)
-
-    # VCS
-    set -l git_root_dir (__bobthefish_git_project_dir $real_pwd)
-    set -l hg_root_dir (__bobthefish_hg_project_dir $real_pwd)
-
-    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 $real_pwd
-            case \*
-                __bobthefish_prompt_hg $hg_root_dir $real_pwd
-        end
-    else if [ "$git_root_dir" ]
-        __bobthefish_prompt_git $git_root_dir $real_pwd
-    else if [ "$hg_root_dir" ]
-        __bobthefish_prompt_hg $hg_root_dir $real_pwd
-    else
-        __bobthefish_prompt_dir $real_pwd
-    end
-
-    __bobthefish_finish_segments
+    set _pure_fresh_session false
 end

+ 3 - 77
fish/.config/fish/functions/fish_right_prompt.fish

@@ -1,79 +1,5 @@
-# You can override some default right prompt options in your config.fish:
-#     set -g theme_date_format "+%a %H:%M"
+function fish_right_prompt \
+    --description "Let user override prompt"
 
-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
-end
-
-function __bobthefish_pretty_ms -S -a ms -a 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
-        case 2.0.\* 2.1.\* 2.2.\* 2.3.\*
-            # Fish 2.3 and lower doesn't know about the -s argument to math.
-            math "scale=$scale;$ms/$interval_ms" | string replace -r '\\.?0*$' $interval
-        case 2.\*
-            # Fish 2.x always returned a float when given the -s argument.
-            math -s$scale "$ms/$interval_ms" | string replace -r '\\.?0*$' $interval
-        case \*
-            math -s$scale "$ms/$interval_ms"
-            echo -ns $interval
-    end
-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
-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
-
-    __bobthefish_cmd_duration
-    __bobthefish_timestamp
-    set_color normal
+    printf "%s%s%s" $pure_color_right_prompt "$pure_right_prompt" $pure_color_normal
 end

+ 10 - 28
fish/.config/fish/functions/fish_title.fish

@@ -1,34 +1,16 @@
-# 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 fish_title \
+    --description "Set title to current folder and shell name" \
+    --argument-names last_command
 
-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
+    set --local basename (string replace -r '^.*/' '' -- $PWD)
+    set --local current_folder (_pure_parse_directory)
+    set --local current_command (status current-command 2>/dev/null; or echo $_)
 
-function fish_title
-    __bobthefish_title_user
+    set --local prompt "$basename: $last_command $pure_symbol_title_bar_separator $current_command"
 
-    if [ "$theme_title_display_process" = 'yes' ]
-        echo $_
-
-        [ "$theme_title_display_path" != 'no' ]
-        and echo ' '
+    if test -z "$last_command"
+        set prompt "$current_folder $pure_symbol_title_bar_separator $current_command"
     end
 
-    if [ "$theme_title_display_path" != 'no' ]
-        if [ "$theme_title_use_abbreviated_path" = 'no' ]
-            echo $PWD
-        else
-            prompt_pwd
-        end
-    end
+    echo $prompt
 end

+ 8 - 0
fish/.config/fish/functions/git_ahead.fish

@@ -0,0 +1,8 @@
+function git_ahead -a ahead behind diverged none
+    command git rev-list --count --left-right "@{upstream}...HEAD" 2>/dev/null | command awk "
+        /^0\t0/         { print \"$none\"       ? \"$none\"     : \"\";     exit 0 }
+        /^[0-9]+\t0/    { print \"$behind\"     ? \"$behind\"   : \"-\";    exit 0 }
+        /^0\t[0-9]+/    { print \"$ahead\"      ? \"$ahead\"    : \"+\";    exit 0 }
+        //              { print \"$diverged\"   ? \"$diverged\" : \"±\";    exit 0 }
+    "
+end

+ 15 - 0
fish/.config/fish/functions/git_branch_name.fish

@@ -0,0 +1,15 @@
+function git_branch_name -d "Get the name of the current Git branch, tag or sha1"
+    set -l branch_name (command git symbolic-ref --short HEAD 2>/dev/null)
+
+    if test -z "$branch_name"
+        set -l tag_name (command git describe --tags --exact-match HEAD 2>/dev/null)
+
+        if test -z "$tag_name"
+            command git rev-parse --short HEAD 2>/dev/null
+        else
+            printf "%s\n" "$tag_name"
+        end
+    else
+        printf "%s\n" "$branch_name"
+    end
+end

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

@@ -0,0 +1,3 @@
+function git_is_detached_head -d "Test if the repository is in a detached HEAD state"
+    git_is_repo; and not command git symbolic-ref HEAD 2>/dev/null > /dev/null
+end

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

@@ -0,0 +1,3 @@
+function git_is_dirty -d "Test if there are changes not staged for commit"
+    git_is_repo; and not command git diff --no-ext-diff --quiet --exit-code 2>/dev/null
+end

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

@@ -0,0 +1,3 @@
+function git_is_empty -d "Test if a repository is empty"
+    git_is_repo; and test -z (command git rev-list -n 1 --all 2>/dev/null)
+end

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

@@ -0,0 +1,5 @@
+function git_is_repo -d "Test if the current directory is a Git repository"
+    if not command git rev-parse --git-dir > /dev/null 2>/dev/null
+        return 1
+    end
+end

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

@@ -0,0 +1,3 @@
+function git_is_staged -d "Test if there are changes staged for commit"
+    git_is_repo; and not command git diff --cached --no-ext-diff --quiet --exit-code 2>/dev/null
+end

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

@@ -0,0 +1,3 @@
+function git_is_stashed -d "Test if there are changes in the Git stash"
+    command git rev-parse --verify --quiet refs/stash > /dev/null 2>/dev/null
+end

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

@@ -0,0 +1,3 @@
+function git_is_tag -d "Test if HEAD is on top of a tag (can be simple, annotated or signed)"
+    git_is_detached_head; and command git describe --tags --exact-match HEAD 2>/dev/null > /dev/null
+end

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

@@ -0,0 +1,3 @@
+function git_is_touched -d "Test if there are any changes in the working tree"
+    git_is_staged; or git_is_dirty
+end

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

@@ -0,0 +1,3 @@
+function git_repository_root -d "Get the top level directory of the current git repository"
+    git_is_repo; and command git rev-parse --show-toplevel
+end

+ 15 - 0
fish/.config/fish/functions/git_untracked_files.fish

@@ -0,0 +1,15 @@
+function git_untracked_files -d "Get the number of untracked files in a repository"
+    git_is_repo; and command git ls-files --others --exclude-standard | command awk '
+
+        BEGIN {
+            n = 0
+        }
+
+        { n++ }
+
+        END {
+            print n
+            exit !n
+        }
+    '
+end

+ 19 - 0
fish/.config/fish/functions/humanize_duration.fish

@@ -0,0 +1,19 @@
+function humanize_duration -d "Make a time interval human readable"
+    command awk '
+        function hmTime(time,   stamp) {
+            split("h:m:s:ms", units, ":")
+            for (i = 2; i >= -1; i--) {
+                if (t = int( i < 0 ? time % 1000 : time / (60 ^ i * 1000) % 60 )) {
+                    stamp = stamp t units[sqrt((i - 2) ^ 2) + 1] " "
+                }
+            }
+            if (stamp ~ /^ *$/) {
+                return "0ms"
+            }
+            return substr(stamp, 1, length(stamp) - 1)
+        }
+        { 
+            print hmTime($0) 
+        }
+    '
+end

+ 9 - 0
ssh/.ssh/config

@@ -7,6 +7,15 @@ Host *
     AddKeysToAgent yes
     IdentityFile ~/.ssh/1904_powellc
 
+# Work GitHub account:
+Host work-github.com
+  HostName github.com
+  User git
+  IdentityFile ~/.ssh/id_ed25519_15five
+  PreferredAuthentications publickey
+  PasswordAuthentication no
+  IdentitiesOnly yes
+
 Host sdf.org
   User secstate