Update fish theme and new functions #fish

This commit is contained in:
Colin Powell
2019-06-21 00:03:44 -04:00
parent 882f54c4d0
commit 9f7cee08f8
8 changed files with 1271 additions and 190 deletions

View File

@ -3,6 +3,3 @@ source ~/.asdf/asdf.fish
set PATH ~/.fzf/bin $PATH
fzf_key_bindings
eval (python -m virtualfish)
#xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics ClickPad" 0
#xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Tap Action" 0

View File

@ -2,4 +2,4 @@ edc/bass
jethrokuan/fzf
2m/fish-gpg-tty
oh-my-fish/plugin-direnv
oh-my-fish/theme-syl20bnr
oh-my-fish/theme-bobthefish

View File

@ -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

View File

@ -0,0 +1,10 @@
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
end

View File

@ -0,0 +1,9 @@
# 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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,79 @@
# 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 -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
end

View File

@ -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