AutoYADM commit: 2025-03-28 20:30:08

This commit is contained in:
Daniel Fichtinger 2025-03-28 20:30:08 -04:00
parent 81805b3bf9
commit d47777c8b9
5 changed files with 35 additions and 205 deletions

View file

@ -1,201 +0,0 @@
status is-interactive
or exit 0
set -g __async_prompt_tmpdir (command mktemp -d)
# Setup after the user defined prompt functions are loaded.
function __async_prompt_setup_on_startup --on-event fish_prompt
functions -e (status current-function)
if test "$async_prompt_enable" = 0
return 0
end
for func in (__async_prompt_config_functions)
function $func -V func
test -e $__async_prompt_tmpdir'/'$fish_pid'_'$func
and cat $__async_prompt_tmpdir'/'$fish_pid'_'$func
end
end
end
function __async_prompt_keep_last_pipestatus
set -g __async_prompt_last_pipestatus $pipestatus
end
not set -q async_prompt_on_variable
and set async_prompt_on_variable fish_bind_mode
function __async_prompt_fire --on-event fish_prompt (for var in $async_prompt_on_variable; printf '%s\n' --on-variable $var; end)
for func in (__async_prompt_config_functions)
set -l tmpfile $__async_prompt_tmpdir'/'$fish_pid'_'$func
if functions -q $func'_loading_indicator' && test -e $tmpfile
read -zl last_prompt <$tmpfile
eval (string escape -- $func'_loading_indicator' "$last_prompt") >$tmpfile
end
__async_prompt_config_inherit_variables | __async_prompt_spawn \
$func' | read -z prompt
echo -n $prompt >'$tmpfile
end
end
function __async_prompt_spawn -a cmd
set -l envs
begin
while read line
switch "$line"
case fish_bind_mode
echo fish_bind_mode $fish_bind_mode
case FISH_VERSION PWD _ history 'fish_*' hostname version status_generation
case status pipestatus
echo pipestatus $__async_prompt_last_pipestatus
case SHLVL
set envs $envs SHLVL=$SHLVL
case '*'
echo $line (string escape -- $$line)
end
end
end | read -lz vars
echo $vars | env $envs fish -c '
function __async_prompt_signal
kill -s "'(__async_prompt_config_internal_signal)'" '$fish_pid' 2>/dev/null
end
while read -a line
test -z "$line"
and continue
if test "$line[1]" = pipestatus
set -f _pipestatus $line[2..]
else
eval set "$line"
end
end
function __async_prompt_set_status
return $argv
end
if set -q _pipestatus
switch (count $_pipestatus)
case 1
__async_prompt_set_status $_pipestatus[1]
case 2
__async_prompt_set_status $_pipestatus[1] \
| __async_prompt_set_status $_pipestatus[2]
case 3
__async_prompt_set_status $_pipestatus[1] \
| __async_prompt_set_status $_pipestatus[2] \
| __async_prompt_set_status $_pipestatus[3]
case 4
__async_prompt_set_status $_pipestatus[1] \
| __async_prompt_set_status $_pipestatus[2] \
| __async_prompt_set_status $_pipestatus[3] \
| __async_prompt_set_status $_pipestatus[4]
case 5
__async_prompt_set_status $_pipestatus[1] \
| __async_prompt_set_status $_pipestatus[2] \
| __async_prompt_set_status $_pipestatus[3] \
| __async_prompt_set_status $_pipestatus[4] \
| __async_prompt_set_status $_pipestatus[5]
case 6
__async_prompt_set_status $_pipestatus[1] \
| __async_prompt_set_status $_pipestatus[2] \
| __async_prompt_set_status $_pipestatus[3] \
| __async_prompt_set_status $_pipestatus[4] \
| __async_prompt_set_status $_pipestatus[5] \
| __async_prompt_set_status $_pipestatus[6]
case 7
__async_prompt_set_status $_pipestatus[1] \
| __async_prompt_set_status $_pipestatus[2] \
| __async_prompt_set_status $_pipestatus[3] \
| __async_prompt_set_status $_pipestatus[4] \
| __async_prompt_set_status $_pipestatus[5] \
| __async_prompt_set_status $_pipestatus[6] \
| __async_prompt_set_status $_pipestatus[7]
case 8
__async_prompt_set_status $_pipestatus[1] \
| __async_prompt_set_status $_pipestatus[2] \
| __async_prompt_set_status $_pipestatus[3] \
| __async_prompt_set_status $_pipestatus[4] \
| __async_prompt_set_status $_pipestatus[5] \
| __async_prompt_set_status $_pipestatus[6] \
| __async_prompt_set_status $_pipestatus[7] \
| __async_prompt_set_status $_pipestatus[8]
default
__async_prompt_set_status $_pipestatus[1] \
| __async_prompt_set_status $_pipestatus[2] \
| __async_prompt_set_status $_pipestatus[3] \
| __async_prompt_set_status $_pipestatus[4] \
| __async_prompt_set_status $_pipestatus[5] \
| __async_prompt_set_status $_pipestatus[6] \
| __async_prompt_set_status $_pipestatus[7] \
| __async_prompt_set_status $_pipestatus[8] \
| __async_prompt_set_status $_pipestatus[-1]
end
else
true
end
'$cmd'
__async_prompt_signal' &
if test (__async_prompt_config_disown) = 1
disown
end
end
function __async_prompt_config_inherit_variables
if set -q async_prompt_inherit_variables
if test "$async_prompt_inherit_variables" = all
set -ng
else
for item in $async_prompt_inherit_variables
echo $item
end
end
else
echo CMD_DURATION
echo fish_bind_mode
echo pipestatus
echo SHLVL
echo status
end
end
function __async_prompt_config_functions
set -l funcs (
if set -q async_prompt_functions
string join \n $async_prompt_functions
else
echo fish_prompt
echo fish_right_prompt
end
)
for func in $funcs
functions -q "$func"
or continue
echo $func
end
end
function __async_prompt_config_internal_signal
if test -z "$async_prompt_signal_number"
echo SIGUSR1
else
echo "$async_prompt_signal_number"
end
end
function __async_prompt_config_disown
if test -z "$async_prompt_disown"
echo 1
else
echo "$async_prompt_disown"
end
end
function __async_prompt_repaint_prompt --on-signal (__async_prompt_config_internal_signal)
commandline -f repaint >/dev/null 2>/dev/null
end
function __async_prompt_tmpdir_cleanup --on-event fish_exit
rm -rf "$__async_prompt_tmpdir"
end

View file

@ -8,5 +8,5 @@ meaningful-ooo/sponge
jorgebucaran/autopair.fish
nickeb96/puffer-fish
paldepind/projectdo
acomagu/fish-async-prompt
gazorby/fish-abbreviation-tips
patrickf1/colored_man_pages.fish

View file

@ -4,12 +4,11 @@ SETUVAR --export ABBR_TIPS_PROMPT:\x5cn\U0001f4a1\x20\x5ce\x5b1m\x7b\x7b\x20\x2e
SETUVAR --export ABBR_TIPS_REGEXES:\x28\x5e\x28\x5cw\x2b\x5cs\x2b\x29\x2b\x28\x2d\x7b1\x2c2\x7d\x29\x5cw\x2b\x29\x28\x5cs\x5cS\x2b\x29\x1e\x28\x5e\x28\x5cs\x3f\x28\x5cw\x2d\x3f\x29\x2b\x29\x7b3\x7d\x29\x2e\x2a\x1e\x28\x5e\x28\x5cs\x3f\x28\x5cw\x2d\x3f\x29\x2b\x29\x7b2\x7d\x29\x2e\x2a\x1e\x28\x5e\x28\x5cs\x3f\x28\x5cw\x2d\x3f\x29\x2b\x29\x7b1\x7d\x29\x2e\x2a
SETUVAR EDITOR:hx
SETUVAR --export TERM:xterm\x2d256color
SETUVAR XDG_CONFIG_HOME:/home/fic/
SETUVAR --export XDG_CONFIG_HOME:/home/fic/\x2econfig
SETUVAR Z_DATA_DIR:/home/fic/\x2elocal/share/z
SETUVAR --export __ABBR_TIPS_KEYS:a__autoyadm\x1ea__cat\x1ea__dnd\x1ea__h\x1ea__lg\x1ea__ls\x1ea__mailconf\x1ea__rm\x1ea__top\x1ea__yadmadd\x1ea__ylg\x1ea__z\x1ea__zi
SETUVAR --export __ABBR_TIPS_VALUES:AUTOYADMPUSH\x3d1\x20\x7e/dev/autoyadm/autoyadm\x2esh\x1ebat\x1edragon\x2ddrop\x1ehx\x1elazygit\x1eexa\x20\x2d\x2dlong\x20\x2d\x2dgit\x20\x2d\x2dheader\x20\x2d\x2dicons\x1ey\x20\x7e/\x2econfig/mail\x1egomi\x1ebtop\x1e\x7e/dev/autoyadm/yadmadd\x2esh\x1eyadm\x20enter\x20lazygit\x1e__zoxide_z\x1e__zoxide_zi
SETUVAR __fish_initialized:3800
SETUVAR _fisher_acomagu_2F_fish_2D_async_2D_prompt_files:\x7e/\x2econfig/fish/conf\x2ed/__async_prompt\x2efish
SETUVAR _fisher_franciscolourenco_2F_done_files:\x7e/\x2econfig/fish/conf\x2ed/done\x2efish
SETUVAR _fisher_gazorby_2F_fish_2D_abbreviation_2D_tips_files:\x7e/\x2econfig/fish/functions/__abbr_tips_bind_newline\x2efish\x1e\x7e/\x2econfig/fish/functions/__abbr_tips_bind_space\x2efish\x1e\x7e/\x2econfig/fish/functions/__abbr_tips_clean\x2efish\x1e\x7e/\x2econfig/fish/functions/__abbr_tips_init\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/abbr_tips\x2efish
SETUVAR _fisher_jorgebucaran_2F_autopair_2E_fish_files:\x7e/\x2econfig/fish/functions/_autopair_backspace\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_insert_left\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_insert_right\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_insert_same\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_tab\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/autopair\x2efish
@ -20,8 +19,9 @@ SETUVAR _fisher_joseluisq_2F_gitnow_40_32_2E_31_32_2E_30__files:\x7e/\x2econfig/
SETUVAR _fisher_meaningful_2D_ooo_2F_sponge_files:\x7e/\x2econfig/fish/functions/_sponge_clear_state\x2efish\x1e\x7e/\x2econfig/fish/functions/_sponge_on_exit\x2efish\x1e\x7e/\x2econfig/fish/functions/_sponge_on_postexec\x2efish\x1e\x7e/\x2econfig/fish/functions/_sponge_on_preexec\x2efish\x1e\x7e/\x2econfig/fish/functions/_sponge_on_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/_sponge_remove_from_history\x2efish\x1e\x7e/\x2econfig/fish/functions/sponge_filter_failed\x2efish\x1e\x7e/\x2econfig/fish/functions/sponge_filter_matched\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/sponge\x2efish
SETUVAR _fisher_nickeb96_2F_puffer_2D_fish_files:\x7e/\x2econfig/fish/functions/_puffer_fish_expand_bang\x2efish\x1e\x7e/\x2econfig/fish/functions/_puffer_fish_expand_dots\x2efish\x1e\x7e/\x2econfig/fish/functions/_puffer_fish_expand_lastarg\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/puffer_fish_key_bindings\x2efish
SETUVAR _fisher_paldepind_2F_projectdo_files:\x7e/\x2econfig/fish/functions/projectdo_build\x2efish\x1e\x7e/\x2econfig/fish/functions/projectdo_run\x2efish\x1e\x7e/\x2econfig/fish/functions/projectdo_test\x2efish\x1e\x7e/\x2econfig/fish/functions/projectdo_tool\x2efish\x1e\x7e/\x2econfig/fish/completions/projectdo\x2efish
SETUVAR _fisher_patrickf1_2F_colored__man__pages_2E_fish_files:\x7e/\x2econfig/fish/functions/cless\x2efish\x1e\x7e/\x2econfig/fish/functions/man\x2efish
SETUVAR _fisher_patrickf1_2F_fzf_2E_fish_files:\x7e/\x2econfig/fish/functions/_fzf_configure_bindings_help\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_extract_var_info\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_preview_changed_file\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_preview_file\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_report_diff_type\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_report_file_type\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_directory\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_git_log\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_git_status\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_history\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_processes\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_variables\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_wrapper\x2efish\x1e\x7e/\x2econfig/fish/functions/fzf_configure_bindings\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/fzf\x2efish\x1e\x7e/\x2econfig/fish/completions/fzf_configure_bindings\x2efish
SETUVAR _fisher_plugins:jorgebucaran/fisher\x1epatrickf1/fzf\x2efish\x1efranciscolourenco/done\x1ejorgebucaran/replay\x2efish\x1ejorgebucaran/spark\x2efish\x1ejoseluisq/gitnow\x402\x2e12\x2e0\x1emeaningful\x2dooo/sponge\x1ejorgebucaran/autopair\x2efish\x1enickeb96/puffer\x2dfish\x1epaldepind/projectdo\x1eacomagu/fish\x2dasync\x2dprompt\x1egazorby/fish\x2dabbreviation\x2dtips
SETUVAR _fisher_plugins:jorgebucaran/fisher\x1epatrickf1/fzf\x2efish\x1efranciscolourenco/done\x1ejorgebucaran/replay\x2efish\x1ejorgebucaran/spark\x2efish\x1ejoseluisq/gitnow\x402\x2e12\x2e0\x1emeaningful\x2dooo/sponge\x1ejorgebucaran/autopair\x2efish\x1enickeb96/puffer\x2dfish\x1epaldepind/projectdo\x1egazorby/fish\x2dabbreviation\x2dtips\x1epatrickf1/colored_man_pages\x2efish
SETUVAR _fisher_upgraded_to_4_4:\x1d
SETUVAR cac_ip:172\x2e30\x2e90\x2e10
SETUVAR fish_color_autosuggestion:89492A

View file

@ -0,0 +1,10 @@
function cless -d "Configure less to colorize styled text using environment variables before executing a command that will use less"
set -x LESS_TERMCAP_md (set_color --bold 0280A5) # start bold
set -x LESS_TERMCAP_me (set_color normal) # end bold
set -x LESS_TERMCAP_us (set_color --underline 5BA502) # start underline
set -x LESS_TERMCAP_ue (set_color normal) # end underline
set -x LESS_TERMCAP_so (set_color --reverse F0CB02) # start standout
set -x LESS_TERMCAP_se (set_color normal) # end standout
$argv
end

View file

@ -0,0 +1,21 @@
function man --wraps man -d "Run man with added colors"
set --local --export MANPATH $MANPATH
# special case for NetBSD and FreeBSD: set MANPATH if not already set
# see https://github.com/fish-shell/fish-shell/blob/555af37616893160ad1afb208a957d6a01a7a315/share/functions/man.fish#L15
if test -z "$MANPATH"
if set path (command man -p 2>/dev/null)
set MANPATH (string replace --regex '[^/]+$' '' $path)
else
set MANPATH ""
end
end
# prepend the directory of fish manpages to MANPATH
set fish_manpath $__fish_data_dir/man
if test -d $fish_manpath
set --prepend MANPATH $fish_manpath
end
cless (command --search man) $argv
end