Use eval for fish_prompt

This commit is contained in:
Ilan Cosman 2021-12-08 09:09:13 -08:00
parent 886b94a6d8
commit 8dde77e9f6
2 changed files with 11 additions and 10 deletions

View File

@ -41,7 +41,7 @@ function _tide_cache_variables
end end
# newline before # newline before
test "$tide_prompt_add_newline_before" = true && set -g _tide_add_newline '' || set -e _tide_add_newline test "$tide_prompt_add_newline_before" = true && set -g _tide_add_newline \e || set -e _tide_add_newline
# item padding # item padding
test "$tide_prompt_pad_items" = true && set -gx _tide_pad ' ' || set -e _tide_pad test "$tide_prompt_pad_items" = true && set -gx _tide_pad ' ' || set -e _tide_pad

View File

@ -16,20 +16,21 @@ function _tide_refresh_prompt --on-variable $_tide_prompt_var
commandline --function repaint commandline --function repaint
end end
function fish_prompt var="function fish_prompt
_tide_status=$status _tide_pipestatus=$pipestatus if not set -e _tide_repaint _tide_status=\$status _tide_pipestatus=\$pipestatus if not set -e _tide_repaint
jobs --query jobs --query
fish --command "set _tide_pipestatus $_tide_pipestatus fish --command \"set _tide_pipestatus \$_tide_pipestatus
_tide_jobs_status=$status CMD_DURATION=$CMD_DURATION COLUMNS=$COLUMNS \ _tide_jobs_status=\$status CMD_DURATION=\$CMD_DURATION COLUMNS=\$COLUMNS \
fish_bind_mode=$fish_bind_mode set $_tide_prompt_var (_tide_prompt)" & fish_bind_mode=\$fish_bind_mode set $_tide_prompt_var (_tide_prompt)\" &
builtin disown builtin disown
command kill $_tide_last_pid 2>/dev/null command kill \$_tide_last_pid 2>/dev/null
set -g _tide_last_pid $last_pid set -g _tide_last_pid \$last_pid
end end
string unescape $_tide_add_newline $$_tide_prompt_var[1][2..] string unescape $_tide_add_newline \$\$_tide_prompt_var[1][2..]
end end" eval "$var"
set -e _tide_add_newline
function fish_right_prompt function fish_right_prompt
string unescape $$_tide_prompt_var[1][1] string unescape $$_tide_prompt_var[1][1]