diff --git a/config/fish/completions/a.fish b/config/fish/completions/a.fish new file mode 100644 index 0000000..16c0f79 --- /dev/null +++ b/config/fish/completions/a.fish @@ -0,0 +1 @@ +complete -c a -a "(__fasd_print_completion -a)" -f -A diff --git a/config/fish/completions/d.fish b/config/fish/completions/d.fish new file mode 100644 index 0000000..3dd7498 --- /dev/null +++ b/config/fish/completions/d.fish @@ -0,0 +1 @@ +complete -c d -a "(__fasd_print_completion -d)" -f -A diff --git a/config/fish/completions/f.fish b/config/fish/completions/f.fish new file mode 100644 index 0000000..714cf0d --- /dev/null +++ b/config/fish/completions/f.fish @@ -0,0 +1 @@ +complete -c f -a "(__fasd_print_completion -f)" -f -A diff --git a/config/fish/completions/fasd.fish b/config/fish/completions/fasd.fish new file mode 100644 index 0000000..edd3062 --- /dev/null +++ b/config/fish/completions/fasd.fish @@ -0,0 +1 @@ +complete -c fasd -a "(__fasd_print_completion)" -f -A diff --git a/config/fish/completions/fasd_cd.fish b/config/fish/completions/fasd_cd.fish new file mode 100644 index 0000000..58d316c --- /dev/null +++ b/config/fish/completions/fasd_cd.fish @@ -0,0 +1 @@ +complete -c fasd_cd -a "(__fasd_print_completion -d)" -f -A diff --git a/config/fish/completions/s.fish b/config/fish/completions/s.fish new file mode 100644 index 0000000..e06b7a1 --- /dev/null +++ b/config/fish/completions/s.fish @@ -0,0 +1 @@ +complete -c s -a "(__fasd_print_completion)" -f -A diff --git a/config/fish/completions/sd.fish b/config/fish/completions/sd.fish new file mode 100644 index 0000000..2c6a212 --- /dev/null +++ b/config/fish/completions/sd.fish @@ -0,0 +1 @@ +complete -c sd -a "(__fasd_print_completion -d)" -f -A diff --git a/config/fish/completions/sf.fish b/config/fish/completions/sf.fish new file mode 100644 index 0000000..9e727d5 --- /dev/null +++ b/config/fish/completions/sf.fish @@ -0,0 +1 @@ +complete -c sf -a "(__fasd_print_completion -f)" -f -A diff --git a/config/fish/completions/z.fish b/config/fish/completions/z.fish new file mode 100644 index 0000000..2679fc2 --- /dev/null +++ b/config/fish/completions/z.fish @@ -0,0 +1 @@ +complete -c z -a "(__fasd_print_completion -d)" -f -A diff --git a/config/fish/completions/zz.fish b/config/fish/completions/zz.fish new file mode 100644 index 0000000..953b113 --- /dev/null +++ b/config/fish/completions/zz.fish @@ -0,0 +1 @@ +complete -c zz -a "(__fasd_print_completion -d)" -f -A diff --git a/config/fish/conf.d/__fasd_run.fish b/config/fish/conf.d/__fasd_run.fish new file mode 100644 index 0000000..0f9d174 --- /dev/null +++ b/config/fish/conf.d/__fasd_run.fish @@ -0,0 +1,4 @@ + function __fasd_run -e fish_preexec -d "fasd takes record of the directories changed into" + command fasd --proc (command fasd --sanitize "$argv") > "/dev/null" 2>&1 & + end + \ No newline at end of file diff --git a/config/fish/conf.d/aliases.fish b/config/fish/conf.d/aliases.fish new file mode 100644 index 0000000..1f0dbe7 --- /dev/null +++ b/config/fish/conf.d/aliases.fish @@ -0,0 +1,3 @@ +# support oldschool autojump user +alias j z +alias jj zz diff --git a/config/fish/fishfile b/config/fish/fishfile index 0181bda..3640a54 100644 --- a/config/fish/fishfile +++ b/config/fish/fishfile @@ -1,3 +1,5 @@ jethrokuan/z jethrokuan/fzf simnalamburt/shellder +fishgretel/fasd +oh-my-fish/theme-bobthefish diff --git a/config/fish/functions/__bobthefish_colors.fish b/config/fish/functions/__bobthefish_colors.fish new file mode 100644 index 0000000..0afe3b8 --- /dev/null +++ b/config/fish/functions/__bobthefish_colors.fish @@ -0,0 +1,575 @@ +function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthefish' + switch "$color_scheme" + case 'user' + __bobthefish_user_color_scheme_deprecated + return + + case 'terminal' 'terminal-dark*' + set -l colorfg black + [ "$color_scheme" = 'terminal-dark-white' ]; and set colorfg white + set -x color_initial_segment_exit white red --bold + set -x color_initial_segment_su white green --bold + set -x color_initial_segment_jobs white blue --bold + + set -x color_path black white + set -x color_path_basename black white --bold + set -x color_path_nowrite magenta $colorfg + set -x color_path_nowrite_basename magenta $colorfg --bold + + set -x color_repo green $colorfg + set -x color_repo_work_tree black $colorfg --bold + set -x color_repo_dirty brred $colorfg + set -x color_repo_staged yellow $colorfg + + set -x color_vi_mode_default brblue $colorfg --bold + set -x color_vi_mode_insert brgreen $colorfg --bold + set -x color_vi_mode_visual bryellow $colorfg --bold + + set -x color_vagrant brcyan $colorfg + set -x color_k8s magenta white --bold + set -x color_username white black --bold + set -x color_hostname white black + set -x color_rvm brmagenta $colorfg --bold + set -x color_virtualfish brblue $colorfg --bold + set -x color_virtualgo brblue $colorfg --bold + set -x color_desk brblue $colorfg --bold + + case 'terminal-light*' + set -l colorfg white + [ "$color_scheme" = 'terminal-light-black' ]; and set colorfg black + set -x color_initial_segment_exit black red --bold + set -x color_initial_segment_su black green --bold + set -x color_initial_segment_jobs black blue --bold + + set -x color_path white black + set -x color_path_basename white black --bold + set -x color_path_nowrite magenta $colorfg + set -x color_path_nowrite_basename magenta $colorfg --bold + + set -x color_repo green $colorfg + set -x color_repo_work_tree white $colorfg --bold + set -x color_repo_dirty brred $colorfg + set -x color_repo_staged yellow $colorfg + + set -x color_vi_mode_default brblue $colorfg --bold + set -x color_vi_mode_insert brgreen $colorfg --bold + set -x color_vi_mode_visual bryellow $colorfg --bold + + set -x color_vagrant brcyan $colorfg + set -x color_k8s magenta white --bold + set -x color_username black white --bold + set -x color_hostname black white + set -x color_rvm brmagenta $colorfg --bold + set -x color_virtualfish brblue $colorfg --bold + set -x color_virtualgo brblue $colorfg --bold + set -x color_desk brblue $colorfg --bold + + case 'terminal2' 'terminal2-dark*' + set -l colorfg black + [ "$color_scheme" = 'terminal2-dark-white' ]; and set colorfg white + set -x color_initial_segment_exit grey red --bold + set -x color_initial_segment_su grey green --bold + set -x color_initial_segment_jobs grey blue --bold + + set -x color_path brgrey white + set -x color_path_basename brgrey white --bold + set -x color_path_nowrite magenta $colorfg + set -x color_path_nowrite_basename magenta $colorfg --bold + + set -x color_repo green $colorfg + set -x color_repo_work_tree brgrey $colorfg --bold + set -x color_repo_dirty brred $colorfg + set -x color_repo_staged yellow $colorfg + + set -x color_vi_mode_default brblue $colorfg --bold + set -x color_vi_mode_insert brgreen $colorfg --bold + set -x color_vi_mode_visual bryellow $colorfg --bold + + set -x color_vagrant brcyan $colorfg + set -x color_k8s magenta white --bold + set -x color_username brgrey white --bold + set -x color_hostname brgrey white + set -x color_rvm brmagenta $colorfg --bold + set -x color_virtualfish brblue $colorfg --bold + set -x color_virtualgo brblue $colorfg --bold + set -x color_desk brblue $colorfg --bold + + case 'terminal2-light*' + set -l colorfg white + [ "$color_scheme" = 'terminal2-light-black' ]; and set colorfg black + set -x color_initial_segment_exit brgrey red --bold + set -x color_initial_segment_su brgrey green --bold + set -x color_initial_segment_jobs brgrey blue --bold + + set -x color_path grey black + set -x color_path_basename grey black --bold + set -x color_path_nowrite magenta $colorfg + set -x color_path_nowrite_basename magenta $colorfg --bold + + set -x color_repo green $colorfg + set -x color_repo_work_tree grey $colorfg --bold + set -x color_repo_dirty brred $colorfg + set -x color_repo_staged yellow $colorfg + + set -x color_vi_mode_default brblue $colorfg --bold + set -x color_vi_mode_insert brgreen $colorfg --bold + set -x color_vi_mode_visual bryellow $colorfg --bold + + set -x color_vagrant brcyan $colorfg + set -x color_k8s magenta white --bold + set -x color_username grey black --bold + set -x color_hostname grey black + set -x color_rvm brmagenta $colorfg --bold + set -x color_virtualfish brblue $colorfg --bold + set -x color_virtualgo brblue $colorfg --bold + set -x color_desk brblue $colorfg --bold + + case 'zenburn' + set -l grey 333333 # a bit darker than normal zenburn grey + set -l red CC9393 + set -l green 7F9F7F + set -l yellow E3CEAB + set -l orange DFAF8F + set -l blue 8CD0D3 + set -l white DCDCCC + + set -x color_initial_segment_exit $white $red --bold + set -x color_initial_segment_su $white $green --bold + set -x color_initial_segment_jobs $white $blue --bold + + set -x color_path $grey $white + set -x color_path_basename $grey $white --bold + set -x color_path_nowrite $grey $red + set -x color_path_nowrite_basename $grey $red --bold + + set -x color_repo $green $grey + set -x color_repo_work_tree $grey $grey --bold + set -x color_repo_dirty $red $grey + set -x color_repo_staged $yellow $grey + + set -x color_vi_mode_default $grey $yellow --bold + set -x color_vi_mode_insert $green $white --bold + set -x color_vi_mode_visual $yellow $grey --bold + + set -x color_vagrant $blue $green --bold + set -x color_k8s $green $white --bold + set -x color_username $grey $blue --bold + set -x color_hostname $grey $blue + set -x color_rvm $red $grey --bold + set -x color_virtualfish $blue $grey --bold + set -x color_virtualgo $blue $grey --bold + set -x color_desk $blue $grey --bold + + case 'base16-light' + set -l base00 181818 + set -l base01 282828 + set -l base02 383838 + set -l base03 585858 + set -l base04 b8b8b8 + set -l base05 d8d8d8 + set -l base06 e8e8e8 + set -l base07 f8f8f8 + set -l base08 ab4642 # red + set -l base09 dc9656 # orange + set -l base0A f7ca88 # yellow + set -l base0B a1b56c # green + set -l base0C 86c1b9 # cyan + set -l base0D 7cafc2 # blue + set -l base0E ba8baf # violet + set -l base0F a16946 # brown + + set -l colorfg $base00 + + set -x color_initial_segment_exit $base02 $base08 --bold + set -x color_initial_segment_su $base02 $base0B --bold + set -x color_initial_segment_jobs $base02 $base0D --bold + + set -x color_path $base06 $base02 + set -x color_path_basename $base06 $base01 --bold + set -x color_path_nowrite $base06 $base08 + set -x color_path_nowrite_basename $base06 $base08 --bold + + set -x color_repo $base0B $colorfg + set -x color_repo_work_tree $base06 $colorfg --bold + set -x color_repo_dirty $base08 $colorfg + set -x color_repo_staged $base09 $colorfg + + set -x color_vi_mode_default $base04 $colorfg --bold + set -x color_vi_mode_insert $base0B $colorfg --bold + set -x color_vi_mode_visual $base09 $colorfg --bold + + set -x color_vagrant $base0C $colorfg --bold + set -x color_k8s $base06 $colorfg --bold + set -x color_username $base02 $base0D --bold + set -x color_hostname $base02 $base0D + set -x color_rvm $base08 $colorfg --bold + set -x color_virtualfish $base0D $colorfg --bold + set -x color_virtualgo $base0D $colorfg --bold + set -x color_desk $base0D $colorfg --bold + + case 'base16' 'base16-dark' + set -l base00 181818 + set -l base01 282828 + set -l base02 383838 + set -l base03 585858 + set -l base04 b8b8b8 + set -l base05 d8d8d8 + set -l base06 e8e8e8 + set -l base07 f8f8f8 + set -l base08 ab4642 # red + set -l base09 dc9656 # orange + set -l base0A f7ca88 # yellow + set -l base0B a1b56c # green + set -l base0C 86c1b9 # cyan + set -l base0D 7cafc2 # blue + set -l base0E ba8baf # violet + set -l base0F a16946 # brown + + set -l colorfg $base07 + + set -x color_initial_segment_exit $base05 $base08 --bold + set -x color_initial_segment_su $base05 $base0B --bold + set -x color_initial_segment_jobs $base05 $base0D --bold + + set -x color_path $base02 $base05 + set -x color_path_basename $base02 $base06 --bold + set -x color_path_nowrite $base02 $base08 + set -x color_path_nowrite_basename $base02 $base08 --bold + + set -x color_repo $base0B $colorfg + set -x color_repo_work_tree $base02 $colorfg --bold + set -x color_repo_dirty $base08 $colorfg + set -x color_repo_staged $base09 $colorfg + + set -x color_vi_mode_default $base03 $colorfg --bold + set -x color_vi_mode_insert $base0B $colorfg --bold + set -x color_vi_mode_visual $base09 $colorfg --bold + + set -x color_vagrant $base0C $colorfg --bold + set -x color_k8s $base0B $colorfg --bold + set -x color_username $base02 $base0D --bold + set -x color_hostname $base02 $base0D + set -x color_rvm $base08 $colorfg --bold + set -x color_virtualfish $base0D $colorfg --bold + set -x color_virtualgo $base0D $colorfg --bold + set -x color_desk $base0D $colorfg --bold + + case 'solarized-light' + set -l base03 002b36 + set -l base02 073642 + set -l base01 586e75 + set -l base00 657b83 + set -l base0 839496 + set -l base1 93a1a1 + set -l base2 eee8d5 + set -l base3 fdf6e3 + set -l yellow b58900 + set -l orange cb4b16 + set -l red dc322f + set -l magenta d33682 + set -l violet 6c71c4 + set -l blue 268bd2 + set -l cyan 2aa198 + set -l green 859900 + + set colorfg $base03 + + set -x color_initial_segment_exit $base02 $red --bold + set -x color_initial_segment_su $base02 $green --bold + set -x color_initial_segment_jobs $base02 $blue --bold + + set -x color_path $base2 $base00 + set -x color_path_basename $base2 $base01 --bold + set -x color_path_nowrite $base2 $orange + set -x color_path_nowrite_basename $base2 $orange --bold + + set -x color_repo $green $colorfg + set -x color_repo_work_tree $base2 $colorfg --bold + set -x color_repo_dirty $red $colorfg + set -x color_repo_staged $yellow $colorfg + + set -x color_vi_mode_default $blue $colorfg --bold + set -x color_vi_mode_insert $green $colorfg --bold + set -x color_vi_mode_visual $yellow $colorfg --bold + + set -x color_vagrant $violet $colorfg --bold + set -x color_k8s $green $colorfg --bold + set -x color_username $base2 $blue --bold + set -x color_hostname $base2 $blue + set -x color_rvm $red $colorfg --bold + set -x color_virtualfish $cyan $colorfg --bold + set -x color_virtualgo $cyan $colorfg --bold + set -x color_desk $cyan $colorfg --bold + + case 'solarized' 'solarized-dark' + set -l base03 002b36 + set -l base02 073642 + set -l base01 586e75 + set -l base00 657b83 + set -l base0 839496 + set -l base1 93a1a1 + set -l base2 eee8d5 + set -l base3 fdf6e3 + set -l yellow b58900 + set -l orange cb4b16 + set -l red dc322f + set -l magenta d33682 + set -l violet 6c71c4 + set -l blue 268bd2 + set -l cyan 2aa198 + set -l green 859900 + + set colorfg $base3 + + set -x color_initial_segment_exit $base2 $red --bold + set -x color_initial_segment_su $base2 $green --bold + set -x color_initial_segment_jobs $base2 $blue --bold + + set -x color_path $base02 $base0 + set -x color_path_basename $base02 $base1 --bold + set -x color_path_nowrite $base02 $orange + set -x color_path_nowrite_basename $base02 $orange --bold + + set -x color_repo $green $colorfg + set -x color_repo_work_tree $base02 $colorfg --bold + set -x color_repo_dirty $red $colorfg + set -x color_repo_staged $yellow $colorfg + + set -x color_vi_mode_default $blue $colorfg --bold + set -x color_vi_mode_insert $green $colorfg --bold + set -x color_vi_mode_visual $yellow $colorfg --bold + + set -x color_vagrant $violet $colorfg --bold + set -x color_k8s $green $colorfg --bold + set -x color_username $base02 $blue --bold + set -x color_hostname $base02 $blue + set -x color_rvm $red $colorfg --bold + set -x color_virtualfish $cyan $colorfg --bold + set -x color_virtualgo $cyan $colorfg --bold + set -x color_desk $cyan $colorfg --bold + + case 'light' + # light medium dark + # ------ ------ ------ + set -l red cc9999 ce000f 660000 + set -l green addc10 189303 0c4801 + set -l blue 48b4fb 005faf 255e87 + set -l orange f6b117 unused 3a2a03 + set -l brown bf5e00 803f00 4d2600 + set -l grey cccccc 999999 333333 + set -l white ffffff + set -l black 000000 + set -l ruby_red af0000 + + set -x color_initial_segment_exit $grey[3] $red[2] --bold + set -x color_initial_segment_su $grey[3] $green[2] --bold + set -x color_initial_segment_jobs $grey[3] $blue[3] --bold + + set -x color_path $grey[1] $grey[2] + set -x color_path_basename $grey[1] $grey[3] --bold + set -x color_path_nowrite $red[1] $red[3] + set -x color_path_nowrite_basename $red[1] $red[3] --bold + + set -x color_repo $green[1] $green[3] + set -x color_repo_work_tree $grey[1] $white --bold + set -x color_repo_dirty $red[2] $white + set -x color_repo_staged $orange[1] $orange[3] + + set -x color_vi_mode_default $grey[2] $grey[3] --bold + set -x color_vi_mode_insert $green[2] $grey[3] --bold + set -x color_vi_mode_visual $orange[1] $orange[3] --bold + + set -x color_vagrant $blue[1] $white --bold + set -x color_k8s $green[1] $colorfg --bold + set -x color_username $grey[1] $blue[3] --bold + set -x color_hostname $grey[1] $blue[3] + set -x color_rvm $ruby_red $grey[1] --bold + set -x color_virtualfish $blue[2] $grey[1] --bold + set -x color_virtualgo $blue[2] $grey[1] --bold + set -x color_desk $blue[2] $grey[1] --bold + + case 'gruvbox' + # light medium dark darkest + # ------ ------ ------ ------- + set -l red fb4934 cc241d + set -l green b8bb26 98971a + set -l yellow fabd2f d79921 + set -l aqua 8ec07c 689d6a + set -l blue 83a598 458588 + set -l grey cccccc 999999 333333 + set -l fg fbf1c7 ebdbb2 d5c4a1 a89984 + set -l bg 504945 282828 + + set -x color_initial_segment_exit $fg[1] $red[2] --bold + set -x color_initial_segment_su $fg[1] $green[2] --bold + set -x color_initial_segment_jobs $fg[1] $aqua[2] --bold + + set -x color_path $bg[1] $fg[2] + set -x color_path_basename $bg[1] $fg[2] --bold + set -x color_path_nowrite $red[1] $fg[2] + set -x color_path_nowrite_basename $red[1] $fg[2] --bold + + set -x color_repo $green[2] $bg[1] + set -x color_repo_work_tree $bg[1] $fg[2] --bold + set -x color_repo_dirty $red[2] $fg[2] + set -x color_repo_staged $yellow[1] $bg[1] + + set -x color_vi_mode_default $fg[4] $bg[2] --bold + set -x color_vi_mode_insert $blue[1] $bg[2] --bold + set -x color_vi_mode_visual $yellow[1] $bg[2] --bold + + set -x color_vagrant $blue[2] $fg[2] --bold + set -x color_k8s $green[2] $fg[2] --bold + set -x color_username $fg[3] $blue[2] --bold + set -x color_hostname $fg[3] $blue[2] + set -x color_rvm $red[2] $fg[2] --bold + set -x color_virtualfish $blue[2] $fg[2] --bold + set -x color_virtualgo $blue[2] $fg[2] --bold + set -x color_desk $blue[2] $fg[2] --bold + + case 'dracula' # https://draculatheme.com + set -l bg 282a36 + set -l current_line 44475a + set -l selection 44475a + set -l fg f8f8f2 + set -l comment 6272a4 + set -l cyan 8be9fd + set -l green 50fa7b + set -l orange ffb86c + set -l pink ff79c6 + set -l purple bd93f9 + set -l red ff5555 + set -l yellow f1fa8c + + set -x color_initial_segment_exit $fg $red --bold + set -x color_initial_segment_su $fg $purple --bold + set -x color_initial_segment_jobs $fg $comment --bold + + set -x color_path $selection $fg + set -x color_path_basename $selection $fg --bold + set -x color_path_nowrite $selection $red + set -x color_path_nowrite_basename $selection $red --bold + + set -x color_repo $green $bg + set -x color_repo_work_tree $selection $fg --bold + set -x color_repo_dirty $red $bg + set -x color_repo_staged $yellow $bg + + set -x color_vi_mode_default $bg $yellow --bold + set -x color_vi_mode_insert $green $bg --bold + set -x color_vi_mode_visual $orange $bg --bold + + set -x color_vagrant $pink $bg --bold + set -x color_k8s $green $fg --bold + set -x color_username $selection $cyan --bold + set -x color_hostname $selection $cyan + set -x color_rvm $red $bg --bold + set -x color_virtualfish $comment $bg --bold + set -x color_virtualgo $cyan $bg --bold + set -x color_desk $comment $bg --bold + + case '*' # default dark theme + # light medium dark + # ------ ------ ------ + set -l red cc9999 ce000f 660000 + set -l green addc10 189303 0c4801 + set -l blue 48b4fb 005faf 255e87 + set -l orange f6b117 unused 3a2a03 + set -l brown bf5e00 803f00 4d2600 + set -l grey cccccc 999999 333333 + set -l white ffffff + set -l black 000000 + set -l ruby_red af0000 + set -l go_blue 00d7d7 + + set -x color_initial_segment_exit $white $red[2] --bold + set -x color_initial_segment_su $white $green[2] --bold + set -x color_initial_segment_jobs $white $blue[3] --bold + + set -x color_path $grey[3] $grey[2] + set -x color_path_basename $grey[3] $white --bold + set -x color_path_nowrite $red[3] $red[1] + set -x color_path_nowrite_basename $red[3] $red[1] --bold + + set -x color_repo $green[1] $green[3] + set -x color_repo_work_tree $grey[3] $white --bold + set -x color_repo_dirty $red[2] $white + set -x color_repo_staged $orange[1] $orange[3] + + set -x color_vi_mode_default $grey[2] $grey[3] --bold + set -x color_vi_mode_insert $green[2] $grey[3] --bold + set -x color_vi_mode_visual $orange[1] $orange[3] --bold + + set -x color_vagrant $blue[1] $white --bold + set -x color_k8s $green[2] $white --bold + set -x color_username $grey[1] $blue[3] --bold + set -x color_hostname $grey[1] $blue[3] + set -x color_rvm $ruby_red $grey[1] --bold + set -x color_virtualfish $blue[2] $grey[1] --bold + set -x color_virtualgo $go_blue $black --bold + set -x color_desk $blue[2] $grey[1] --bold + end +end + +function __bobthefish_user_color_scheme_deprecated + set -q __color_initial_segment_exit; or set -l __color_initial_segment_exit ffffff ce000f --bold + set -q __color_initial_segment_su; or set -l __color_initial_segment_su ffffff 189303 --bold + set -q __color_initial_segment_jobs; or set -l __color_initial_segment_jobs ffffff 255e87 --bold + set -q __color_path; or set -l __color_path 333333 999999 + set -q __color_path_basename; or set -l __color_path_basename 333333 ffffff --bold + set -q __color_path_nowrite; or set -l __color_path_nowrite 660000 cc9999 + set -q __color_path_nowrite_basename; or set -l __color_path_nowrite_basename 660000 cc9999 --bold + set -q __color_repo; or set -l __color_repo addc10 0c4801 + set -q __color_repo_work_tree; or set -l __color_repo_work_tree 333333 ffffff --bold + set -q __color_repo_dirty; or set -l __color_repo_dirty ce000f ffffff + set -q __color_repo_staged; or set -l __color_repo_staged f6b117 3a2a03 + set -q __color_vi_mode_default; or set -l __color_vi_mode_default 999999 333333 --bold + set -q __color_vi_mode_insert; or set -l __color_vi_mode_insert 189303 333333 --bold + set -q __color_vi_mode_visual; or set -l __color_vi_mode_visual f6b117 3a2a03 --bold + set -q __color_vagrant; or set -l __color_vagrant 48b4fb ffffff --bold + set -q __color_username; or set -l __color_username cccccc 255e87 --bold + set -q __color_hostname; or set -l __color_hostname cccccc 255e87 + set -q __color_rvm; or set -l __color_rvm af0000 cccccc --bold + set -q __color_virtualfish; or set -l __color_virtualfish 005faf cccccc --bold + set -q __color_virtualgo; or set -l __color_virtualgo 005faf cccccc --bold + set -q __color_desk; or set -l __color_desk 005faf cccccc --bold + + set_color black -b red --bold + echo "The 'user' color scheme is deprecated." + set_color normal + set_color black -b red + echo "To define a custom color scheme, create a 'bobthefish_colors' function:" + set_color normal + echo + + echo "function bobthefish_colors -S -d 'Define a custom bobthefish color scheme' + + # optionally include a base color scheme... + ___bobthefish_colors default + + # then override everything you want! note that these must be defined with `set -x` + set -x color_initial_segment_exit $__color_initial_segment_exit + set -x color_initial_segment_su $__color_initial_segment_su + set -x color_initial_segment_jobs $__color_initial_segment_jobs + set -x color_path $__color_path + set -x color_path_basename $__color_path_basename + set -x color_path_nowrite $__color_path_nowrite + set -x color_path_nowrite_basename $__color_path_nowrite_basename + set -x color_repo $__color_repo + set -x color_repo_work_tree $__color_repo_work_tree + set -x color_repo_dirty $__color_repo_dirty + set -x color_repo_staged $__color_repo_staged + set -x color_vi_mode_default $__color_vi_mode_default + set -x color_vi_mode_insert $__color_vi_mode_insert + set -x color_vi_mode_visual $__color_vi_mode_visual + set -x color_vagrant $__color_vagrant + set -x color_username $__color_username + set -x color_hostname $__color_hostname + set -x color_rvm $__color_rvm + set -x color_virtualfish $__color_virtualfish + set -x color_virtualgo $__color_virtualgo + set -x color_desk $__color_desk +end" + + echo +end diff --git a/config/fish/functions/__bobthefish_display_colors.fish b/config/fish/functions/__bobthefish_display_colors.fish new file mode 100644 index 0000000..210a803 --- /dev/null +++ b/config/fish/functions/__bobthefish_display_colors.fish @@ -0,0 +1,3 @@ +function __bobthefish_display_colors -d 'Print example prompts using the current color scheme' + bobthefish_display_colors +end diff --git a/config/fish/functions/__bobthefish_glyphs.fish b/config/fish/functions/__bobthefish_glyphs.fish new file mode 100644 index 0000000..2e8a8f1 --- /dev/null +++ b/config/fish/functions/__bobthefish_glyphs.fish @@ -0,0 +1,89 @@ +function __bobthefish_glyphs -S -d 'Define glyphs used by bobthefish' + # Powerline glyphs + set -x branch_glyph \uE0A0 + set -x right_black_arrow_glyph \uE0B0 + set -x right_arrow_glyph \uE0B1 + set -x left_black_arrow_glyph \uE0B2 + set -x left_arrow_glyph \uE0B3 + + # Additional glyphs + set -x detached_glyph \u27A6 + set -x tag_glyph \u2302 + set -x nonzero_exit_glyph '! ' + set -x superuser_glyph '$ ' + set -x bg_job_glyph '% ' + set -x hg_glyph \u263F + + # Python glyphs + set -x superscript_glyph \u00B9 \u00B2 \u00B3 + set -x virtualenv_glyph \u25F0 + set -x pypy_glyph \u1D56 + + set -x ruby_glyph '' + set -x go_glyph '' + + # Desk glyphs + set -x desk_glyph \u25F2 + + # Vagrant glyphs + set -x vagrant_running_glyph \u2191 # ↑ 'running' + set -x vagrant_poweroff_glyph \u2193 # ↓ 'poweroff' + set -x vagrant_aborted_glyph \u2715 # ✕ 'aborted' + set -x vagrant_saved_glyph \u21E1 # ⇡ 'saved' + set -x vagrant_stopping_glyph \u21E3 # ⇣ 'stopping' + set -x vagrant_unknown_glyph '!' # strange cases + + # Git glyphs + set -x git_dirty_glyph '*' + set -x git_staged_glyph '~' + set -x git_stashed_glyph '$' + set -x git_untracked_glyph '…' + set -x git_ahead_glyph \u2191 # '↑' + set -x git_behind_glyph \u2193 # '↓' + set -x git_plus_glyph '+' + set -x git_minus_glyph '-' + set -x git_plus_minus_glyph '±' + + # Disable Powerline fonts + if [ "$theme_powerline_fonts" = "no" ] + set branch_glyph \u2387 + set right_black_arrow_glyph '' + set right_arrow_glyph '' + set left_black_arrow_glyph '' + set left_arrow_glyph '' + end + + # Use prettier Nerd Fonts glyphs + if [ "$theme_nerd_fonts" = "yes" ] + set branch_glyph \uF418 + set detached_glyph \uF417 + set tag_glyph \uF412 + + set virtualenv_glyph \uE73C ' ' + set ruby_glyph \uE791 ' ' + set go_glyph \uE626 ' ' + + set vagrant_running_glyph \uF431 # ↑ 'running' + set vagrant_poweroff_glyph \uF433 # ↓ 'poweroff' + set vagrant_aborted_glyph \uF468 # ✕ 'aborted' + set vagrant_unknown_glyph \uF421 # strange cases + + set git_dirty_glyph \uF448 '' # nf-oct-pencil + set git_staged_glyph \uF0C7 '' # nf-fa-save + set git_stashed_glyph \uF0C6 '' # nf-fa-paperclip + set git_untracked_glyph \uF128 '' # nf-fa-question + # set git_untracked_glyph \uF141 '' # nf-fa-ellipsis_h + + set git_ahead_glyph \uF47B # nf-oct-chevron_up + set git_behind_glyph \uF47C # nf-oct-chevron_down + + set git_plus_glyph \uF0DE # fa-sort-asc + set git_minus_glyph \uF0DD # fa-sort-desc + set git_plus_minus_glyph \uF0DC # fa-sort + end + + # Avoid ambiguous glyphs + if [ "$theme_avoid_ambiguous_glyphs" = "yes" ] + set git_untracked_glyph '...' + end +end diff --git a/config/fish/functions/__fasd_print_completion.fish b/config/fish/functions/__fasd_print_completion.fish new file mode 100644 index 0000000..23eec98 --- /dev/null +++ b/config/fish/functions/__fasd_print_completion.fish @@ -0,0 +1,5 @@ +function __fasd_print_completion + set cmd (commandline -po) + test (count $cmd) -ge 2; and fasd $argv $cmd[2..-1] -l +end + \ No newline at end of file diff --git a/config/fish/functions/a.fish b/config/fish/functions/a.fish new file mode 100644 index 0000000..b71bbea --- /dev/null +++ b/config/fish/functions/a.fish @@ -0,0 +1,3 @@ +function a -d "fasd match files and directories" + command fasd -a $argv +end diff --git a/config/fish/functions/bobthefish_display_colors.fish b/config/fish/functions/bobthefish_display_colors.fish new file mode 100644 index 0000000..e147468 --- /dev/null +++ b/config/fish/functions/bobthefish_display_colors.fish @@ -0,0 +1,133 @@ +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 diff --git a/config/fish/functions/d.fish b/config/fish/functions/d.fish new file mode 100644 index 0000000..f47f689 --- /dev/null +++ b/config/fish/functions/d.fish @@ -0,0 +1,3 @@ +function d -d "fasd match directories only" + command fasd -d $argv +end diff --git a/config/fish/functions/f.fish b/config/fish/functions/f.fish new file mode 100644 index 0000000..eeb476f --- /dev/null +++ b/config/fish/functions/f.fish @@ -0,0 +1,3 @@ +function f -d "fasd match files only" + command fasd -f $argv +end diff --git a/config/fish/functions/fasd_cd.fish b/config/fish/functions/fasd_cd.fish new file mode 100644 index 0000000..98fb5a9 --- /dev/null +++ b/config/fish/functions/fasd_cd.fish @@ -0,0 +1,9 @@ +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 diff --git a/config/fish/functions/fish_greeting.fish b/config/fish/functions/fish_greeting.fish new file mode 100644 index 0000000..25f44c3 --- /dev/null +++ b/config/fish/functions/fish_greeting.fish @@ -0,0 +1,6 @@ +function fish_greeting -d "What's up, fish?" + set_color $fish_color_autosuggestion + uname -nmsr + uptime + set_color normal +end diff --git a/config/fish/functions/fish_mode_prompt.fish b/config/fish/functions/fish_mode_prompt.fish index 36b0b94..4c7a3b9 100644 --- a/config/fish/functions/fish_mode_prompt.fish +++ b/config/fish/functions/fish_mode_prompt.fish @@ -1,15 +1,11 @@ -function fish_mode_prompt - if test "$fish_key_bindings" = "fish_vi_key_bindings" - or test "$fish_key_bindings" = "fish_hybrid_key_bindings" - switch $fish_bind_mode - case default - prompt_segment blue black "N" - case insert - prompt_segment green black "I" - case replace_one - prompt_segment red black "R" - case visual - prompt_segment magenta black "V" - end - end -end +# 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 +# +set -g theme_nerd_fonts yes +set -g GPG_TTY (tty) + +function fish_mode_prompt; end diff --git a/config/fish/functions/fish_right_prompt.fish b/config/fish/functions/fish_right_prompt.fish new file mode 100644 index 0000000..524e887 --- /dev/null +++ b/config/fish/functions/fish_right_prompt.fish @@ -0,0 +1,70 @@ +# 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 +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 +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 +end diff --git a/config/fish/functions/fish_title.fish b/config/fish/functions/fish_title.fish new file mode 100644 index 0000000..2914000 --- /dev/null +++ b/config/fish/functions/fish_title.fish @@ -0,0 +1,34 @@ +# 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 diff --git a/config/fish/functions/s.fish b/config/fish/functions/s.fish new file mode 100644 index 0000000..80b1a3f --- /dev/null +++ b/config/fish/functions/s.fish @@ -0,0 +1,3 @@ +function s -d "fasd show, search, select" + command fasd -si $argv +end diff --git a/config/fish/functions/sd.fish b/config/fish/functions/sd.fish new file mode 100644 index 0000000..ebcf0d2 --- /dev/null +++ b/config/fish/functions/sd.fish @@ -0,0 +1,3 @@ +function sd -d "fasd interactive directory selection" + command fasd -sid $argv +end diff --git a/config/fish/functions/sf.fish b/config/fish/functions/sf.fish new file mode 100644 index 0000000..b71b0f4 --- /dev/null +++ b/config/fish/functions/sf.fish @@ -0,0 +1,3 @@ +function sf -d "fasd interactive file selection" + command fasd -sif $argv +end diff --git a/config/fish/functions/z.fish b/config/fish/functions/z.fish new file mode 100644 index 0000000..0b8b56d --- /dev/null +++ b/config/fish/functions/z.fish @@ -0,0 +1,3 @@ +function z -d "fasd cd, same functionality as j in autojump" + fasd_cd -d $argv +end diff --git a/config/fish/functions/zz.fish b/config/fish/functions/zz.fish new file mode 100644 index 0000000..db796fe --- /dev/null +++ b/config/fish/functions/zz.fish @@ -0,0 +1,3 @@ +function zz -d "fasd cd with interactive selection" + fasd_cd -di $argv +end