mirror of
https://github.com/kp2pml30/dotfiles.git
synced 2026-02-20 09:04:42 +04:00
upd
This commit is contained in:
parent
67857e5ae8
commit
9b79d32c60
6 changed files with 201 additions and 6 deletions
37
home-test/.config/fish/functions/fish_right_prompt.fish
Normal file
37
home-test/.config/fish/functions/fish_right_prompt.fish
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
function fish_right_prompt
|
||||
return
|
||||
|
||||
# Last command status
|
||||
set -l code $status
|
||||
|
||||
# https://github.com/fish-shell/fish-shell/issues/3476#issuecomment-256058730
|
||||
# Save the cursor position, move it up one line, and move it to the right two spaces
|
||||
tput sc; tput cuf 2
|
||||
|
||||
#if test $code != 0
|
||||
# echo -ns (set_color red) '-' $code '- '
|
||||
#end
|
||||
|
||||
set_color $fish_color_autosuggestion 2> /dev/null; or set_color 555
|
||||
|
||||
# Output the duration of the last command
|
||||
if test $CMD_DURATION -ge 500
|
||||
if test $CMD_DURATION -ge 60000
|
||||
set -l duration_minutes (math "floor($CMD_DURATION / 60000)")
|
||||
set -l duration_seconds (math "round(($CMD_DURATION % 60000) / 1000)")
|
||||
printf "%02d:%02d " $duration_minutes $duration_seconds
|
||||
else if test $CMD_DURATION -ge 1000
|
||||
set -l duration_seconds (math "round($CMD_DURATION / 1000)")
|
||||
echo "$duration_seconds""s "
|
||||
else
|
||||
echo "$CMD_DURATION""ms "
|
||||
end
|
||||
end
|
||||
|
||||
# Output the current time
|
||||
echo (date "+%H:%M:%S")
|
||||
|
||||
# Restores the cursor position
|
||||
tput rc
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue