mirror of
https://github.com/oh-my-fish/theme-bobthefish.git
synced 2026-03-02 03:49:25 +00:00
move files to support fisher plugin standards (#293)
This commit is contained in:
10
functions/fish_greeting.fish
Normal file
10
functions/fish_greeting.fish
Normal 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 command uptime
|
||||
|
||||
set_color normal
|
||||
end
|
||||
42
functions/fish_mode_prompt.fish
Normal file
42
functions/fish_mode_prompt.fish
Normal file
@@ -0,0 +1,42 @@
|
||||
# Display the current binding mode... if it's vi or vi-like.
|
||||
#
|
||||
# To always show the binding mode (regardless of current bindings):
|
||||
# set -g theme_display_vi yes
|
||||
#
|
||||
# To never show:
|
||||
# set -g theme_display_vi no
|
||||
|
||||
function fish_mode_prompt -d 'bobthefish-optimized fish mode indicator'
|
||||
[ "$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
|
||||
|
||||
__bobthefish_colors $theme_color_scheme
|
||||
|
||||
type -q bobthefish_colors
|
||||
and bobthefish_colors
|
||||
|
||||
set_color normal # clear out anything bold or underline...
|
||||
|
||||
switch $fish_bind_mode
|
||||
case default
|
||||
set_color -b $color_vi_mode_default
|
||||
echo -n ' N '
|
||||
case insert
|
||||
set_color -b $color_vi_mode_insert
|
||||
echo -n ' I '
|
||||
case replace_one replace-one
|
||||
set_color -b $color_vi_mode_insert
|
||||
echo -n ' R '
|
||||
case visual
|
||||
set_color -b $color_vi_mode_visual
|
||||
echo -n ' V '
|
||||
end
|
||||
|
||||
set_color normal
|
||||
end
|
||||
1152
functions/fish_prompt.fish
Normal file
1152
functions/fish_prompt.fish
Normal file
File diff suppressed because it is too large
Load Diff
82
functions/fish_right_prompt.fish
Normal file
82
functions/fish_right_prompt.fish
Normal file
@@ -0,0 +1,82 @@
|
||||
# You can override some default right prompt options in your config.fish:
|
||||
# set -g theme_date_format "+%a %H:%M"
|
||||
# set -g theme_date_timezone America/Los_Angeles
|
||||
|
||||
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 ' '
|
||||
set -q theme_date_timezone
|
||||
and env TZ="$theme_date_timezone" date $theme_date_format
|
||||
or 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" -a "$theme_nerd_fonts" != "yes" ]
|
||||
set __bobthefish_left_arrow_glyph '<'
|
||||
end
|
||||
|
||||
set_color $fish_color_autosuggestion
|
||||
|
||||
__bobthefish_cmd_duration
|
||||
__bobthefish_timestamp
|
||||
set_color normal
|
||||
end
|
||||
34
functions/fish_title.fish
Normal file
34
functions/fish_title.fish
Normal 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
|
||||
Reference in New Issue
Block a user