zsh having right prompt on same level as left using prezto

933 views Asked by At

I'm new to zsh and also prezto. Now as in my bash shell I want to have the current path on the left and my current branch at the right as you can see in the picture so far so good.....

Prompt

... Now the problem is the right part of the prompt is in the second line and not in the one the path is in!

# Define prompts.
PROMPT="
[ ${_prompt_steeef_colors[3]}%n%f@${_prompt_steeef_colors[2]}%m%f ] ${_prompt_steeef_colors[5]}%~%f 
"'$python_info[virtualenv]'"$ "
RPROMPT='${vcs_info_msg_0_}'

(Complete source code: here)

How can I achieve both path and branch at the same line in my custom prezto prompt?

1

There are 1 answers

0
Tim Helmstedt On

If you don't care about rendering artifacts when resizing windows, you can use control characters to hack this functionality in:

local _lineup=$'\e[1A'
local _linedown=$'\e[1B'
RPROMPT=%{${_lineup}%}"some stuff"%{${_linedown}%}

I found this here: https://superuser.com/questions/357107/zsh-right-justify-in-ps1/737454#737454