Skip to content

Commit

Permalink
fish: re-add fish_variables
Browse files Browse the repository at this point in the history
  • Loading branch information
itsfarseen committed Mar 29, 2024
1 parent 0e14cae commit 3df373b
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 9 deletions.
1 change: 0 additions & 1 deletion config/fish/.gitignore

This file was deleted.

31 changes: 23 additions & 8 deletions config/fish/conf.d/__async_prompt.fish
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ 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
Expand All @@ -15,11 +18,13 @@ function __async_prompt_setup_on_startup --on-event fish_prompt
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)
set -l __async_prompt_last_pipestatus $pipestatus

for func in (__async_prompt_config_functions)
set -l tmpfile $__async_prompt_tmpdir'/'$fish_pid'_'$func

Expand All @@ -28,7 +33,7 @@ function __async_prompt_fire --on-event fish_prompt (for var in $async_prompt_on
eval (string escape -- $func'_loading_indicator' "$last_prompt") >$tmpfile
end

__async_prompt_config_inherit_variables | __async_prompt_last_pipestatus=$__async_prompt_last_pipestatus __async_prompt_spawn \
__async_prompt_config_inherit_variables | __async_prompt_spawn \
$func' | read -z prompt
echo -n $prompt >'$tmpfile
end
Expand Down Expand Up @@ -130,12 +135,10 @@ function __async_prompt_spawn -a cmd
true
end
'$cmd'
__async_prompt_signal
sleep 0.3
__async_prompt_signal
sleep 0.3
__async_prompt_signal' &
disown
if test (__async_prompt_config_disown) = 1
disown
end
end

function __async_prompt_config_inherit_variables
Expand Down Expand Up @@ -181,6 +184,18 @@ function __async_prompt_config_internal_signal
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
6 changes: 6 additions & 0 deletions config/fish/conf.d/_z-make-portable.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Don't use set -U here
# set -U stores the actual value of $HOME in the fish_variables file
# which is tracked in the dotfiles repo.
# This makes it non-portable.
set -x Z_DATA $HOME/.local/share/z/data
set -xp Z_EXCLUDE $HOME
23 changes: 23 additions & 0 deletions config/fish/fish_variables
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR ZO_CMD:zo
SETUVAR Z_CMD:z
SETUVAR __fish_initialized:3400
SETUVAR _fisher_acomagu_2F_fish_2D_async_2D_prompt_files:\x7e/\x2econfig/fish/conf\x2ed/__async_prompt\x2efish
SETUVAR _fisher_itsfarseen_2F_nvm_2E_fish_files:\x7e/\x2econfig/fish/functions/_nvm_index_update\x2efish\x1e\x7e/\x2econfig/fish/functions/_nvm_list\x2efish\x1e\x7e/\x2econfig/fish/functions/_nvm_version_activate\x2efish\x1e\x7e/\x2econfig/fish/functions/_nvm_version_deactivate\x2efish\x1e\x7e/\x2econfig/fish/functions/nvm\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/nvm\x2efish\x1e\x7e/\x2econfig/fish/completions/nvm\x2efish
SETUVAR _fisher_jethrokuan_2F_z_files:\x7e/\x2econfig/fish/functions/__z\x2efish\x1e\x7e/\x2econfig/fish/functions/__z_add\x2efish\x1e\x7e/\x2econfig/fish/functions/__z_clean\x2efish\x1e\x7e/\x2econfig/fish/functions/__z_complete\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/z\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
SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish
SETUVAR _fisher_plugins:jorgebucaran/fisher\x1ejorgebucaran/autopair\x2efish\x1eacomagu/fish\x2dasync\x2dprompt\x1ejethrokuan/z\x1eitsfarseen/nvm\x2efish
SETUVAR _fisher_upgraded_to_4_4:\x1d
SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_cwd:green
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:normal
SETUVAR fish_color_host_remote:yellow
SETUVAR fish_color_status:red
SETUVAR fish_color_user:brgreen
SETUVAR fish_color_valid_path:\x2d\x2dunderline
SETUVAR fish_greeting:\x1d
SETUVAR fish_key_bindings:fish_default_key_bindings

0 comments on commit 3df373b

Please sign in to comment.