mirror of
https://github.com/starship/starship.git
synced 2025-02-16 10:21:29 +01:00
fix(fish): improve fish transient prompt (#6107)
* feat(fish): improve fish transient prompt * feat(fish): improve fish transient prompt
This commit is contained in:
parent
e629ea1c7a
commit
274dff37db
@ -11,6 +11,7 @@ function fish_prompt
|
|||||||
set STARSHIP_DURATION "$CMD_DURATION$cmd_duration"
|
set STARSHIP_DURATION "$CMD_DURATION$cmd_duration"
|
||||||
set STARSHIP_JOBS (count (jobs -p))
|
set STARSHIP_JOBS (count (jobs -p))
|
||||||
if test "$TRANSIENT" = "1"
|
if test "$TRANSIENT" = "1"
|
||||||
|
set -g TRANSIENT 0
|
||||||
# Clear from cursor to end of screen as `commandline -f repaint` does not do this
|
# Clear from cursor to end of screen as `commandline -f repaint` does not do this
|
||||||
# See https://github.com/fish-shell/fish-shell/issues/8418
|
# See https://github.com/fish-shell/fish-shell/issues/8418
|
||||||
printf \e\[0J
|
printf \e\[0J
|
||||||
@ -36,7 +37,8 @@ function fish_right_prompt
|
|||||||
# Account for changes in variable name between v2.7 and v3.0
|
# Account for changes in variable name between v2.7 and v3.0
|
||||||
set STARSHIP_DURATION "$CMD_DURATION$cmd_duration"
|
set STARSHIP_DURATION "$CMD_DURATION$cmd_duration"
|
||||||
set STARSHIP_JOBS (count (jobs -p))
|
set STARSHIP_JOBS (count (jobs -p))
|
||||||
if test "$TRANSIENT" = "1"
|
if test "$RIGHT_TRANSIENT" = "1"
|
||||||
|
set -g RIGHT_TRANSIENT 0
|
||||||
if type -q starship_transient_rprompt_func
|
if type -q starship_transient_rprompt_func
|
||||||
starship_transient_rprompt_func
|
starship_transient_rprompt_func
|
||||||
else
|
else
|
||||||
@ -58,14 +60,19 @@ set -gx STARSHIP_SHELL "fish"
|
|||||||
# Transience related functions
|
# Transience related functions
|
||||||
function reset-transient --on-event fish_postexec
|
function reset-transient --on-event fish_postexec
|
||||||
set -g TRANSIENT 0
|
set -g TRANSIENT 0
|
||||||
|
set -g RIGHT_TRANSIENT 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function transient_execute
|
function transient_execute
|
||||||
if commandline --is-valid
|
if commandline --paging-mode
|
||||||
|
commandline -f accept-autosuggestion
|
||||||
|
return
|
||||||
|
end
|
||||||
|
commandline --is-valid
|
||||||
|
if test $status != 2
|
||||||
set -g TRANSIENT 1
|
set -g TRANSIENT 1
|
||||||
|
set -g RIGHT_TRANSIENT 1
|
||||||
commandline -f repaint
|
commandline -f repaint
|
||||||
else
|
|
||||||
set -g TRANSIENT 0
|
|
||||||
end
|
end
|
||||||
commandline -f execute
|
commandline -f execute
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user