making fish do fish instead of starship

This commit is contained in:
Chris Cochrun 2021-10-03 07:28:40 -05:00
parent 7606fc5369
commit df85b0ca2e
2 changed files with 134 additions and 130 deletions

View file

@ -19,148 +19,148 @@ end
## Instead of using a fish prompt, I'm using the starship-rs cross shell prompt. ## Instead of using a fish prompt, I'm using the starship-rs cross shell prompt.
# function fish_title function fish_title
# if [ "$theme_display_virtualenv" = 'no' -o -z "$VIRTUAL_ENV" ] if [ "$theme_display_virtualenv" = 'no' -o -z "$VIRTUAL_ENV" ]
# printf '(%s) %s' $_ (prompt_pwd) printf '(%s) %s' $_ (prompt_pwd)
# else else
# printf '(%s) %s' (basename "$VIRTUAL_ENV") (prompt_pwd) printf '(%s) %s' (basename "$VIRTUAL_ENV") (prompt_pwd)
# end end
# end end
# function _prompt_whoami -a sep_color -a color -d "Display user@host if on a SSH session" function _prompt_whoami -a sep_color -a color -d "Display user@host if on a SSH session"
# if set -q SSH_TTY if set -q SSH_TTY
# echo -n -s $color (whoami)@(hostnamectl --static) $sep_color '|' echo -n -s $color (whoami)@(hostnamectl --static) $sep_color '|'
# end end
# end end
# function _git_branch_name function _git_branch_name
# echo (command git symbolic-ref HEAD 2> /dev/null | sed -e 's|^refs/heads/||') echo (command git symbolic-ref HEAD 2> /dev/null | sed -e 's|^refs/heads/||')
# end end
# function _is_git_dirty function _is_git_dirty
# echo (command git status -s --ignore-submodules=dirty 2> /dev/null) echo (command git status -s --ignore-submodules=dirty 2> /dev/null)
# end end
# function _git_ahead_count -a remote -a branch_name function _git_ahead_count -a remote -a branch_name
# echo (command git log $remote/$branch_name..HEAD 2> /dev/null | \ echo (command git log $remote/$branch_name..HEAD 2> /dev/null | \
# grep '^commit' | wc -l | tr -d ' ') grep '^commit' | wc -l | tr -d ' ')
# end end
# function _git_dirty_remotes -a remote_color -a ahead_color function _git_dirty_remotes -a remote_color -a ahead_color
# set current_branch (command git rev-parse --abbrev-ref HEAD 2> /dev/null) set current_branch (command git rev-parse --abbrev-ref HEAD 2> /dev/null)
# set current_ref (command git rev-parse HEAD 2> /dev/null) set current_ref (command git rev-parse HEAD 2> /dev/null)
# for remote in (git remote | grep 'origin\|upstream') for remote in (git remote | grep 'origin\|upstream')
# set -l git_ahead_count (_git_ahead_count $remote $current_branch) set -l git_ahead_count (_git_ahead_count $remote $current_branch)
# set remote_branch "refs/remotes/$remote/$current_branch" set remote_branch "refs/remotes/$remote/$current_branch"
# set remote_ref (git for-each-ref --format='%(objectname)' $remote_branch) set remote_ref (git for-each-ref --format='%(objectname)' $remote_branch)
# if test "$remote_ref" != '' if test "$remote_ref" != ''
# if test "$remote_ref" != $current_ref if test "$remote_ref" != $current_ref
# if [ $git_ahead_count != 0 ] if [ $git_ahead_count != 0 ]
# echo -n "$remote_color!" echo -n "$remote_color!"
# echo -n "$ahead_color+$git_ahead_count$normal" echo -n "$ahead_color+$git_ahead_count$normal"
# end end
# end end
# end end
# end end
# end end
# function _prompt_git -a gray normal orange red yellow function _prompt_git -a gray normal orange red yellow
# test "$theme_display_git" = no; and return test "$theme_display_git" = no; and return
# set -l git_branch (_git_branch_name) set -l git_branch (_git_branch_name)
# test -z $git_branch; and return test -z $git_branch; and return
# if test "$theme_display_git_dirty" = no if test "$theme_display_git_dirty" = no
# echo -n -s $gray '' $yellow $git_branch $gray ' ' echo -n -s $gray '' $yellow $git_branch $gray ' '
# return return
# end end
# set dirty_remotes (_git_dirty_remotes $red $orange) set dirty_remotes (_git_dirty_remotes $red $orange)
# if [ (_is_git_dirty) ] if [ (_is_git_dirty) ]
# echo -n -s $gray '' $yellow $git_branch $red '*' $dirty_remotes $gray ' ' echo -n -s $gray '' $yellow $git_branch $red '*' $dirty_remotes $gray ' '
# else else
# echo -n -s $gray '' $yellow $git_branch $red $dirty_remotes $gray ' ' echo -n -s $gray '' $yellow $git_branch $red $dirty_remotes $gray ' '
# end end
# end end
# function _prompt_pwd function _prompt_pwd
# set_color -o cyan set_color -o cyan
# printf '%s' (prompt_pwd) printf '%s' (prompt_pwd)
# end end
# function _prompt_status_arrows -a exit_code function _prompt_status_arrows -a exit_code
# if test $exit_code -ne 0 if test $exit_code -ne 0
# set arrow_colors green set arrow_colors green
# else else
# set arrow_colors green set arrow_colors green
# end end
# for arrow_color in $arrow_colors for arrow_color in $arrow_colors
# set_color $arrow_color set_color $arrow_color
# printf '»' printf '»'
# end end
# end end
# function fish_prompt function fish_prompt
# set -l exit_code $status set -l exit_code $status
# set -l gray (set_color 666) set -l gray (set_color 666)
# set -l blue (set_color blue) set -l blue (set_color blue)
# set -l red (set_color red) set -l red (set_color red)
# set -l normal (set_color normal) set -l normal (set_color normal)
# set -l yellow (set_color yellow) set -l yellow (set_color yellow)
# set -l orange (set_color ff9900) set -l orange (set_color ff9900)
# set -l green (set_color green) set -l green (set_color green)
# printf $gray'[' printf $gray'['
# _prompt_whoami $gray $green _prompt_whoami $gray $green
# if test "$theme_display_pwd_on_second_line" != yes if test "$theme_display_pwd_on_second_line" != yes
# _prompt_pwd _prompt_pwd
# printf '%s' $gray printf '%s' $gray
# end end
# printf '%s] ⚡️ %0.3fs' $gray (math $CMD_DURATION / 1000) printf '%s] ⚡️ %0.3fs' $gray (math $CMD_DURATION / 1000)
# if set -q SCORPHISH_GIT_INFO_ON_FIRST_LINE if set -q SCORPHISH_GIT_INFO_ON_FIRST_LINE
# set theme_display_git_on_first_line set theme_display_git_on_first_line
# end end
# if set -q theme_display_git_on_first_line if set -q theme_display_git_on_first_line
# _prompt_git $gray $normal $orange $red $yellow _prompt_git $gray $normal $orange $red $yellow
# end end
# if test "$theme_display_pwd_on_second_line" = yes if test "$theme_display_pwd_on_second_line" = yes
# printf $gray'\n' printf $gray'\n'
# _prompt_pwd _prompt_pwd
# printf $gray'' printf $gray''
# end end
# printf '\n' printf '\n'
# if not set -q theme_display_git_on_first_line if not set -q theme_display_git_on_first_line
# _prompt_git $gray $normal $orange $red $yellow _prompt_git $gray $normal $orange $red $yellow
# end end
# _prompt_status_arrows $exit_code _prompt_status_arrows $exit_code
# printf ' ' printf ' '
# set_color normal set_color normal
# end end
# function fish_right_prompt function fish_right_prompt
# set -l exit_code $status set -l exit_code $status
# if test $exit_code -ne 0 if test $exit_code -ne 0
# set_color red set_color red
# else else
# set_color green set_color green
# end end
# printf '%d' $exit_code printf '%d' $exit_code
# set_color -o 666 set_color -o 666
# echo '|' echo '|'
# set_color -o 777 set_color -o 777
# printf '%s' (date +%H:%M:%S) printf '%s' (date +%H:%M:%S)
# set_color normal set_color normal
# end end
### VI MODES ### VI MODES
# Emulates vim's cursor shape behavior # Emulates vim's cursor shape behavior
@ -202,7 +202,7 @@ function fish_user_key_bindings
bind -M insert '$' __history_previous_command_arguments bind -M insert '$' __history_previous_command_arguments
end end
starship init fish | source # starship init fish | source
### ALIASES ### ALIASES
alias yay "paru" alias yay "paru"

4
scripts/ping-plasma.5s.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
ping=$(ping -c 4 1.1.1.1 | tail -1| awk '{print $4}' | cut -d '/' -f 2)
echo "$ping | color=#57c7ff font='VictorMono Nerd Font' size=11"