* Unexpected behavior with prompt -p {prompt name}
@ 2016-06-04 8:42 Sebastian Gniazdowski
2016-06-04 12:49 ` Sebastian Gniazdowski
0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Gniazdowski @ 2016-06-04 8:42 UTC (permalink / raw)
To: Zsh Users
Hello,
I've started a project to gather themes for Zsh that base on the
original Zshell prompt subsystem:
https://github.com/psprint/zprompts
i have problem with first theme added. I build prompt in following way:
local _lpar="${cl_parens}["
local _rpar="${cl_parens}]"
local _time="$cl_time_line%D{%H:%M}"
local _user="$cl_text%n"
local _at="$cl_at_colon@$cl_text%m"
local _path="$cl_at_colon:$cl_text%30<*<%/"
local _line="$cl_time_line%i"
local _prompt="$cl_prompt# "
PS1="$_time$_lpar$_user$_at$_path$_rpar$_line$_prompt$cl_rst"
And it works fine, displaying:
10:38[sgniazdowski@MacMini:/Users/sgniazdowski]2#
However, prompt -p results in "]" being eaten, right after the path. I
tried adding various things after $_path, and they all get eaten.
Resulting in:
10:40[sgniazdowski@MacMini:*4# command arg1 arg2 ... argn
What is wrong with the line:
local _path="$cl_at_colon:$cl_text%30<*<%/"
? $cl_* are just colors, the two are defined as:
local col_text=${3:-'cyan'}
local col_at_colon=${4:-'yellow'}
local cl_text="%b%F{$col_text}"
local cl_at_colon="%b%F{$col_at_colon}"
Best regards,
Sebastian Gniazdowski
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Unexpected behavior with prompt -p {prompt name}
2016-06-04 8:42 Unexpected behavior with prompt -p {prompt name} Sebastian Gniazdowski
@ 2016-06-04 12:49 ` Sebastian Gniazdowski
2016-06-04 17:07 ` Bart Schaefer
0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Gniazdowski @ 2016-06-04 12:49 UTC (permalink / raw)
To: Zsh Users
Hello
Turns out I need %<< after %/? Seems logical but docs provide example
without %<< ("For example, if the current directory is ‘/home/pike’,
the prompt ‘%8<..<%/’ will expand to ‘..e/pike’.")
Best regards,
Sebastian Gniazdowski
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Unexpected behavior with prompt -p {prompt name}
2016-06-04 12:49 ` Sebastian Gniazdowski
@ 2016-06-04 17:07 ` Bart Schaefer
0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2016-06-04 17:07 UTC (permalink / raw)
To: Zsh Users
On Jun 4, 2:49pm, Sebastian Gniazdowski wrote:
}
} Turns out I need %<< after %/? Seems logical but docs provide example
} without %<< ("For example, if the current directory is `/home/pike',
} the prompt `%8<..<%/' will expand to `..e/pike'.")
The example is showing the entire contents of the prompt; the %<< is
not needed if the prompt string ends after %/ but in your case there
is more stuff following.
Probably not most ideal example, though. A have a nagging thought that
when first introduced, %<< could only truncate the entire remainder of
the prompt and didn't stop at the next %<<, so when the example was made
up there was probably no reason to close the truncation.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-04 17:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-04 8:42 Unexpected behavior with prompt -p {prompt name} Sebastian Gniazdowski
2016-06-04 12:49 ` Sebastian Gniazdowski
2016-06-04 17:07 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).