[fish] Remove hydro prompt.
This commit is contained in:
parent
a9e29eadac
commit
e704bb6f17
|
@ -1,137 +0,0 @@
|
|||
status is-interactive || exit
|
||||
|
||||
set --global _hydro_git _hydro_git_$fish_pid
|
||||
|
||||
function $_hydro_git --on-variable $_hydro_git
|
||||
commandline --function repaint
|
||||
end
|
||||
|
||||
function _hydro_pwd --on-variable PWD --on-variable hydro_ignored_git_paths --on-variable fish_prompt_pwd_dir_length
|
||||
set --local git_root (command git --no-optional-locks rev-parse --show-toplevel 2>/dev/null)
|
||||
set --local git_base (string replace --all --regex -- "^.*/" "" "$git_root")
|
||||
set --local path_sep /
|
||||
|
||||
test "$fish_prompt_pwd_dir_length" = 0 && set path_sep
|
||||
|
||||
if set --query git_root[1] && ! contains -- $git_root $hydro_ignored_git_paths
|
||||
set --erase _hydro_skip_git_prompt
|
||||
else
|
||||
set --global _hydro_skip_git_prompt
|
||||
end
|
||||
|
||||
set --global _hydro_pwd (
|
||||
string replace --ignore-case -- ~ \~ $PWD |
|
||||
string replace -- "/$git_base/" /:/ |
|
||||
string replace --regex --all -- "(\.?[^/]{"(
|
||||
string replace --regex --all -- '^$' 1 "$fish_prompt_pwd_dir_length"
|
||||
)"})[^/]*/" "\$1$path_sep" |
|
||||
string replace -- : "$git_base" |
|
||||
string replace --regex -- '([^/]+)$' "\x1b[1m\$1\x1b[22m" |
|
||||
string replace --regex --all -- '(?!^/$)/|^$' "\x1b[2m/\x1b[22m"
|
||||
)
|
||||
end
|
||||
|
||||
function _hydro_postexec --on-event fish_postexec
|
||||
set --local last_status $pipestatus
|
||||
set --global _hydro_status "$_hydro_newline$_hydro_color_prompt$hydro_symbol_prompt"
|
||||
|
||||
for code in $last_status
|
||||
if test $code -ne 0
|
||||
set --global _hydro_status "$_hydro_color_error| "(echo $last_status)" $_hydro_newline$_hydro_color_prompt$_hydro_color_error$hydro_symbol_prompt"
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
test "$CMD_DURATION" -lt $hydro_cmd_duration_threshold && set _hydro_cmd_duration && return
|
||||
|
||||
set --local secs (math --scale=1 $CMD_DURATION/1000 % 60)
|
||||
set --local mins (math --scale=0 $CMD_DURATION/60000 % 60)
|
||||
set --local hours (math --scale=0 $CMD_DURATION/3600000)
|
||||
|
||||
set --local out
|
||||
|
||||
test $hours -gt 0 && set --local --append out $hours"h"
|
||||
test $mins -gt 0 && set --local --append out $mins"m"
|
||||
test $secs -gt 0 && set --local --append out $secs"s"
|
||||
|
||||
set --global _hydro_cmd_duration "$out "
|
||||
end
|
||||
|
||||
function _hydro_prompt --on-event fish_prompt
|
||||
set --query _hydro_status || set --global _hydro_status "$_hydro_newline$_hydro_color_prompt$hydro_symbol_prompt"
|
||||
set --query _hydro_pwd || _hydro_pwd
|
||||
|
||||
command kill $_hydro_last_pid 2>/dev/null
|
||||
|
||||
set --query _hydro_skip_git_prompt && set $_hydro_git && return
|
||||
|
||||
fish --private --command "
|
||||
set branch (
|
||||
command git symbolic-ref --short HEAD 2>/dev/null ||
|
||||
command git describe --tags --exact-match HEAD 2>/dev/null ||
|
||||
command git rev-parse --short HEAD 2>/dev/null |
|
||||
string replace --regex -- '(.+)' '@\$1'
|
||||
)
|
||||
|
||||
test -z \"\$$_hydro_git\" && set --universal $_hydro_git \"\$branch \"
|
||||
|
||||
! command git diff-index --quiet HEAD 2>/dev/null ||
|
||||
count (command git ls-files --others --exclude-standard) >/dev/null && set info \"$hydro_symbol_git_dirty\"
|
||||
|
||||
for fetch in $hydro_fetch false
|
||||
command git rev-list --count --left-right @{upstream}...@ 2>/dev/null |
|
||||
read behind ahead
|
||||
|
||||
switch \"\$behind \$ahead\"
|
||||
case \" \" \"0 0\"
|
||||
case \"0 *\"
|
||||
set upstream \" $hydro_symbol_git_ahead\$ahead\"
|
||||
case \"* 0\"
|
||||
set upstream \" $hydro_symbol_git_behind\$behind\"
|
||||
case \*
|
||||
set upstream \" $hydro_symbol_git_ahead\$ahead $hydro_symbol_git_behind\$behind\"
|
||||
end
|
||||
|
||||
set --universal $_hydro_git \"\$branch\$info\$upstream \"
|
||||
|
||||
test \$fetch = true && command git fetch --no-tags 2>/dev/null
|
||||
end
|
||||
" &
|
||||
|
||||
set --global _hydro_last_pid $last_pid
|
||||
end
|
||||
|
||||
function _hydro_fish_exit --on-event fish_exit
|
||||
set --erase $_hydro_git
|
||||
end
|
||||
|
||||
function _hydro_uninstall --on-event hydro_uninstall
|
||||
set --names |
|
||||
string replace --filter --regex -- "^(_?hydro_)" "set --erase \$1" |
|
||||
source
|
||||
functions --erase (functions --all | string match --entire --regex "^_?hydro_")
|
||||
end
|
||||
|
||||
set --global hydro_color_normal (set_color normal)
|
||||
|
||||
for color in hydro_color_{pwd,git,error,prompt,duration}
|
||||
function $color --on-variable $color --inherit-variable color
|
||||
set --query $color && set --global _$color (set_color $$color)
|
||||
end && $color
|
||||
end
|
||||
|
||||
function hydro_multiline --on-variable hydro_multiline
|
||||
if test "$hydro_multiline" = true
|
||||
set --global _hydro_newline "\n"
|
||||
else
|
||||
set --global _hydro_newline ""
|
||||
end
|
||||
end && hydro_multiline
|
||||
|
||||
set --query hydro_color_error || set --global hydro_color_error $fish_color_error
|
||||
set --query hydro_symbol_prompt || set --global hydro_symbol_prompt ❱
|
||||
set --query hydro_symbol_git_dirty || set --global hydro_symbol_git_dirty •
|
||||
set --query hydro_symbol_git_ahead || set --global hydro_symbol_git_ahead ↑
|
||||
set --query hydro_symbol_git_behind || set --global hydro_symbol_git_behind ↓
|
||||
set --query hydro_multiline || set --global hydro_multiline false
|
||||
set --query hydro_cmd_duration_threshold || set --global hydro_cmd_duration_threshold 1000
|
|
@ -1,2 +1 @@
|
|||
jorgebucaran/fisher
|
||||
jorgebucaran/hydro
|
||||
|
|
|
@ -3,33 +3,30 @@
|
|||
SETUVAR --export QT_QPA_PLATFORM:
|
||||
SETUVAR __fish_initialized:3400
|
||||
SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish
|
||||
SETUVAR _fisher_jorgebucaran_2F_hydro_files:\x7e/\x2econfig/fish/functions/fish_mode_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/fish_prompt\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/hydro\x2efish
|
||||
SETUVAR _fisher_plugins:jorgebucaran/fisher\x1ejorgebucaran/hydro
|
||||
SETUVAR _fisher_plugins:jorgebucaran/fisher
|
||||
SETUVAR _fisher_upgraded_to_4_4:\x1d
|
||||
SETUVAR _hydro_git_273879:main\u2022\x20\u21912\x20
|
||||
SETUVAR _hydro_git_641872:main\u2022\x20\u21913\x20\u21933\x20
|
||||
SETUVAR fish_color_autosuggestion:4D5566
|
||||
SETUVAR fish_color_autosuggestion:707A8C
|
||||
SETUVAR fish_color_cancel:\x2d\x2dreverse
|
||||
SETUVAR fish_color_command:39BAE6
|
||||
SETUVAR fish_color_comment:626A73
|
||||
SETUVAR fish_color_cwd:59C2FF
|
||||
SETUVAR fish_color_command:5CCFE6
|
||||
SETUVAR fish_color_comment:5C6773
|
||||
SETUVAR fish_color_cwd:73D0FF
|
||||
SETUVAR fish_color_cwd_root:red
|
||||
SETUVAR fish_color_end:F29668
|
||||
SETUVAR fish_color_end:F29E74
|
||||
SETUVAR fish_color_error:FF3333
|
||||
SETUVAR fish_color_escape:95E6CB
|
||||
SETUVAR fish_color_history_current:\x2d\x2dbold
|
||||
SETUVAR fish_color_host:normal
|
||||
SETUVAR fish_color_host_remote:\x1d
|
||||
SETUVAR fish_color_keyword:\x1d
|
||||
SETUVAR fish_color_match:F07178
|
||||
SETUVAR fish_color_normal:B3B1AD
|
||||
SETUVAR fish_color_operator:E6B450
|
||||
SETUVAR fish_color_match:F28779
|
||||
SETUVAR fish_color_normal:CBCCC6
|
||||
SETUVAR fish_color_operator:FFCC66
|
||||
SETUVAR fish_color_option:\x1d
|
||||
SETUVAR fish_color_param:B3B1AD
|
||||
SETUVAR fish_color_quote:C2D94C
|
||||
SETUVAR fish_color_redirection:FFEE99
|
||||
SETUVAR fish_color_search_match:\x2d\x2dbackground\x3dE6B450
|
||||
SETUVAR fish_color_selection:\x2d\x2dbackground\x3dE6B450
|
||||
SETUVAR fish_color_param:CBCCC6
|
||||
SETUVAR fish_color_quote:BAE67E
|
||||
SETUVAR fish_color_redirection:D4BFFF
|
||||
SETUVAR fish_color_search_match:\x2d\x2dbackground\x3dFFCC66
|
||||
SETUVAR fish_color_selection:\x2d\x2dbackground\x3dFFCC66
|
||||
SETUVAR fish_color_status:red
|
||||
SETUVAR fish_color_user:brgreen
|
||||
SETUVAR fish_color_valid_path:\x2d\x2dunderline
|
||||
|
@ -43,7 +40,7 @@ SETUVAR fish_pager_color_secondary_background:\x1d
|
|||
SETUVAR fish_pager_color_secondary_completion:\x1d
|
||||
SETUVAR fish_pager_color_secondary_description:\x1d
|
||||
SETUVAR fish_pager_color_secondary_prefix:\x1d
|
||||
SETUVAR fish_pager_color_selected_background:\x2d\x2dbackground\x3dE6B450
|
||||
SETUVAR fish_pager_color_selected_background:\x2d\x2dbackground\x3dFFCC66
|
||||
SETUVAR fish_pager_color_selected_completion:\x1d
|
||||
SETUVAR fish_pager_color_selected_description:\x1d
|
||||
SETUVAR fish_pager_color_selected_prefix:\x1d
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
function fish_mode_prompt
|
||||
if test "$fish_key_bindings" != fish_default_key_bindings
|
||||
set --local vi_mode_color
|
||||
set --local vi_mode_symbol
|
||||
switch $fish_bind_mode
|
||||
case default
|
||||
set vi_mode_color (set_color $fish_color_selection)
|
||||
set vi_mode_symbol N
|
||||
case insert
|
||||
set vi_mode_color (set_color $fish_color_selection)
|
||||
set vi_mode_symbol I
|
||||
case replace replace_one
|
||||
set vi_mode_color (set_color $fish_color_match)
|
||||
set vi_mode_symbol R
|
||||
case visual
|
||||
set vi_mode_color (set_color $fish_color_match)
|
||||
set vi_mode_symbol V
|
||||
end
|
||||
echo -e "$vi_mode_color $vi_mode_symbol \x1b[0m "
|
||||
end
|
||||
end
|
|
@ -1,56 +1,31 @@
|
|||
function fish_prompt --description 'Write out the prompt'
|
||||
set -l last_status $status
|
||||
set -l last_pipestatus $pipestatus
|
||||
set -lx __fish_last_status $status # Export for __fish_print_pipestatus.
|
||||
set -l normal (set_color normal)
|
||||
set -q fish_color_status
|
||||
or set -g fish_color_status red
|
||||
|
||||
prompt_login
|
||||
|
||||
echo -n ':'
|
||||
|
||||
# PWD
|
||||
set_color $fish_color_cwd
|
||||
echo -n (prompt_pwd)
|
||||
set_color normal
|
||||
|
||||
set -q __fish_git_prompt_showdirtystate
|
||||
or set -g __fish_git_prompt_showdirtystate 1
|
||||
set -q __fish_git_prompt_showuntrackedfiles
|
||||
or set -g __fish_git_prompt_showuntrackedfiles 1
|
||||
set -q __fish_git_prompt_showcolorhints
|
||||
or set -g __fish_git_prompt_showcolorhints 1
|
||||
set -q __fish_git_prompt_color_untrackedfiles
|
||||
or set -g __fish_git_prompt_color_untrackedfiles yellow
|
||||
set -q __fish_git_prompt_char_untrackedfiles
|
||||
or set -g __fish_git_prompt_char_untrackedfiles '?'
|
||||
set -q __fish_git_prompt_color_invalidstate
|
||||
or set -g __fish_git_prompt_color_invalidstate red
|
||||
set -q __fish_git_prompt_char_invalidstate
|
||||
or set -g __fish_git_prompt_char_invalidstate '!'
|
||||
set -q __fish_git_prompt_color_dirtystate
|
||||
or set -g __fish_git_prompt_color_dirtystate blue
|
||||
set -q __fish_git_prompt_char_dirtystate
|
||||
or set -g __fish_git_prompt_char_dirtystate '*'
|
||||
set -q __fish_git_prompt_char_stagedstate
|
||||
or set -g __fish_git_prompt_char_stagedstate '✚'
|
||||
set -q __fish_git_prompt_color_cleanstate
|
||||
or set -g __fish_git_prompt_color_cleanstate green
|
||||
set -q __fish_git_prompt_char_cleanstate
|
||||
or set -g __fish_git_prompt_char_cleanstate '✓'
|
||||
set -q __fish_git_prompt_color_stagedstate
|
||||
or set -g __fish_git_prompt_color_stagedstate yellow
|
||||
set -q __fish_git_prompt_color_branch_dirty
|
||||
or set -g __fish_git_prompt_color_branch_dirty red
|
||||
set -q __fish_git_prompt_color_branch_staged
|
||||
or set -g __fish_git_prompt_color_branch_staged yellow
|
||||
set -q __fish_git_prompt_color_branch
|
||||
or set -g __fish_git_prompt_color_branch green
|
||||
set -q __fish_git_prompt_char_stateseparator
|
||||
or set -g __fish_git_prompt_char_stateseparator '⚡'
|
||||
fish_vcs_prompt '|%s'
|
||||
echo
|
||||
|
||||
if not test $last_status -eq 0
|
||||
set_color $fish_color_error
|
||||
# Color the prompt differently when we're root
|
||||
set -l color_cwd $fish_color_cwd
|
||||
set -l suffix '>'
|
||||
if functions -q fish_is_root_user; and fish_is_root_user
|
||||
if set -q fish_color_cwd_root
|
||||
set color_cwd $fish_color_cwd_root
|
||||
end
|
||||
set suffix '#'
|
||||
end
|
||||
|
||||
echo -n '➤ '
|
||||
set_color normal
|
||||
# Write pipestatus
|
||||
# If the status was carried over (if no command is issued or if `set` leaves the status untouched), don't bold it.
|
||||
set -l bold_flag --bold
|
||||
set -q __fish_prompt_status_generation; or set -g __fish_prompt_status_generation $status_generation
|
||||
if test $__fish_prompt_status_generation = $status_generation
|
||||
set bold_flag
|
||||
end
|
||||
set __fish_prompt_status_generation $status_generation
|
||||
set -l status_color (set_color $fish_color_status)
|
||||
set -l statusb_color (set_color $bold_flag $fish_color_status)
|
||||
set -l prompt_status (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus)
|
||||
|
||||
echo -n -s (prompt_login)' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) $normal " "$prompt_status $suffix " "
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue