mirror of
https://github.com/powerline/powerline.git
synced 2025-07-23 22:05:43 +02:00
Support multiline prompt in fish
Note: fish does not accept prompt strings that have width identical to the terminal width: it makes prompt be reduced to just `>`.
This commit is contained in:
parent
5df7b36c3a
commit
8849f9d3d6
@ -10,15 +10,35 @@ function powerline-setup
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function --on-variable POWERLINE_COMMAND _powerline_update
|
function --on-variable POWERLINE_COMMAND _powerline_update
|
||||||
set -l addargs "--last_exit_code=\$status --last_pipe_status=\$status --jobnum=(jobs -p | wc -l)"
|
set -l addargs "--last_exit_code=\$status"
|
||||||
|
set -l addargs "$addargs --last_pipe_status=\$status"
|
||||||
|
set -l addargs "$addargs --jobnum=(jobs -p | wc -l)"
|
||||||
|
set -l addargs "$addargs --width=\$_POWERLINE_COLUMNS"
|
||||||
|
set -l promptside
|
||||||
|
set -l rpromptpast
|
||||||
|
set -l columnsexpr
|
||||||
|
if test -z "$POWERLINE_NO_FISH_ABOVE$POWERLINE_NO_SHELL_ABOVE"
|
||||||
|
set promptside aboveleft
|
||||||
|
set rpromptpast 'echo -n " "'
|
||||||
|
set columnsexpr '(math $COLUMNS - 1)'
|
||||||
|
else
|
||||||
|
set promptside left
|
||||||
|
set rpromptpast
|
||||||
|
set columnsexpr '$COLUMNS'
|
||||||
|
end
|
||||||
eval "
|
eval "
|
||||||
function fish_prompt
|
function fish_prompt
|
||||||
$POWERLINE_COMMAND shell left $addargs
|
$POWERLINE_COMMAND shell $promptside $addargs
|
||||||
end
|
end
|
||||||
function fish_right_prompt
|
function fish_right_prompt
|
||||||
$POWERLINE_COMMAND shell right $addargs
|
$POWERLINE_COMMAND shell right $addargs
|
||||||
|
$rpromptpast
|
||||||
|
end
|
||||||
|
function --on-signal WINCH _powerline_set_columns
|
||||||
|
set -g _POWERLINE_COLUMNS $columnsexpr
|
||||||
end
|
end
|
||||||
"
|
"
|
||||||
|
_powerline_set_columns
|
||||||
end
|
end
|
||||||
_powerline_update
|
_powerline_update
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user