How can you get the prompt "/home/user@address:/path" for Zsh?
I run the following unsuccessfully in my .zshrc
PROMPT='%d%>:%{\e[0m%} '
I get as my prompt
/home/masi
|
|
This might be give you what you want (user@host:path):
If you wanted to limit the length of the path (
If you did not actually want the embedded escape code in there (it is a typical VT100-style command to clear any bold/etc. formatting), you could simplify it to this:
|
|||||||||||
|
|
In this case the manual might be really helpful. I'm guessing you want something like: Apparently actually reading the 4 sentences in the short manual page is too much work. Maybe because it's a link: 13. Prompt Expansion 13.1 Expansion of Prompt Sequences Prompt sequences undergo a special form of expansion. This type of expansion is also available using the -P option to the print builtin. If the PROMPT_SUBST option is set, ... Certain escape sequences may be recognised in the prompt string. If the PROMPT_BANG option is set, ... If the PROMPT_PERCENT option is set, ... 13.2 Simple Prompt Escapes 13.2.1 Special characters %% A `%'. %) A `)'. 13.2.2 Login information %l The line (tty) ... %M The full machine hostname. %m The hostname up to the first `.'. An integer may follow the `%' to specify how many components of the hostname are desired. With a negative integer, trailing components of the hostname are shown. %n $USERNAME. %y The line (tty) ... 13.2.3 Shell state %# A `#' if the shell is running with privileges, ... %? The return status ... %_ The status of the parser, ... %d %/ Present working directory ($PWD). If an integer follows the `%', it specifies a number of trailing components of $PWD to show; zero means the whole path. A negative integer specifies leading components, i.e. %-1d specifies the first component. %~ As %d and %/, but if $PWD has a named directory as its prefix, that part is replaced by a `~' followed by the name of the directory. If it starts with $HOME, that part is replaced by a `~'. %h %! Current history event number. %i The line number ... %I The line number ... %j The number of jobs. %L The current value of $SHLVL. %N The name of the script, ... %x The name of the file ... %c %. %C Trailing component ...These are deprecated... equivalent to %1~ and %1/ ... 13.2.4 Date and time ... Ignored ... 13.2.5 Visual effects ... Ignored ... 13.3 Conditional Substrings in Prompts ... Possibly useful but ignored ... |
|||||||||
|