tide/functions/lean_right_prompt.fish

37 lines
860 B
Fish
Raw Normal View History

2020-04-21 21:52:24 +03:00
function lean_right_prompt
2020-05-15 07:53:37 +03:00
set -l splitText (string split '\n' (_fetch_right_prompt_items))
for thing in $splitText[1..-2]
_print_at_end $thing
end
2020-05-16 02:06:01 +03:00
if test (count $splitText) -eq $lean_left_prompt_height
2020-05-15 07:53:37 +03:00
set -g fishRightPromptRun $splitText[-1]
else
_print_at_end $splitText[-1]
set -g fishRightPromptRun ''
end
echo
end
function fish_right_prompt
echo $fishRightPromptRun
end
function _fetch_right_prompt_items
2020-04-30 00:52:58 +03:00
echo -n ' '
2020-04-28 01:37:08 +03:00
for item in lean_{$lean_right_prompt_items}
2020-05-09 01:32:58 +03:00
set -l itemOutput (_$item)
2020-05-09 01:32:58 +03:00
if test -n "$itemOutput"
2020-05-15 07:53:37 +03:00
echo -n $itemOutput
2020-05-09 01:32:58 +03:00
end
set_color normal
end
2020-05-15 07:53:37 +03:00
end
function _print_at_end -a text
set -l startLocation (math $COLUMNS-(string length (lean_decolor $text)))
echo -ne '\033['$startLocation'C'
echo $text
2020-04-21 21:52:24 +03:00
end