From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: DeWitt Clinton <dewitt@siva.tripod.com>, zsh-users@math.gatech.edu
Subject: Re: On the topic of prompts
Date: Thu, 11 Jul 1996 16:00:33 -0700 [thread overview]
Message-ID: <960711160041.ZM10008@candle.brasslantern.com> (raw)
In-Reply-To: DeWitt Clinton <dewitt@siva.tripod.com> "On the topic of prompts" (Jul 11, 1:51pm)
On Jul 11, 1:51pm, DeWitt Clinton wrote:
> Subject: On the topic of prompts
>
> Since there is probably no way to justify a section of the prompt, perhaps
> there is a way to tell rprompt to write to the line just above using
> control characters? Just wondering...
Sure. Note that the following won't work properly if you don't have a
newline in PS1.
RPS1="%{$(echotc ku)%}whatever you want here%{$(echotc kd)%}"
You might have to replace $(echotc ku) and $(echotc kd) with different
up and down escapes for your terminal if your terminal has a keypad
transmit mode, because keypad mode is normally not in use.
I tried $(echotc up) and $(echotc do) but that doesn't work because "do"
is frequently just ctrl-J, which zsh strips out of rprompts.
> Also, is there a way to pad the variables with spaces? If so, that would
> solve this problem entirely.
Sort of.
precmd() {
fakePS1=$(print -nP " %h %m %n %~ %W")
unset fakeRPS1 # Clear any previous `typeset -R`
fakeRPS1=$(print -nP %@)
if [[ $[$COLUMNS-$#fakePS1-$#fakeRPS1-2] -gt 0 ]]
then
typeset -R $[$COLUMNS-$#fakePS1-1] fakeRPS1="$fakeRPS1"
PS1="$fakePS1$fakeRPS1
% "
else
PS1="$fakePS1
% "
fi
}
> While I am thinking about it, what I am really looking for is a status bar
> that would just sit at the top of the screen and hold certain useful
> information. Anyone know of how to achieve this?
You can play all sorts of games with %{...%} and termcap sequences if
your terminal can set scrolling regions and so forth. If you're using
an xterm, you can use something like this to change the title bar:
if [[ "$TERM" = xterm* || "$TERM" = vs100 || "$TERM" = vs100s ]]
then
# Set top to introduce titlebar change
top='^[]0;'
# Set back to end titlebar change
back='\a'
# Create precmd() to put stuff in the title bar
precmd() { print -nP "%{$top%m.%l:%2c - %t$back%}" }
fi
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
New male in /home/schaefer:
>N 2 Justin William Schaefer Sat May 11 03:43 53/4040 "Happy Birthday"
next prev parent reply other threads:[~1996-07-11 23:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-07-11 6:01 zsh 3pre2: carriage return in prompt Timothy J. Luoma
1996-07-11 13:55 ` Zoltan Hidvegi
1996-07-11 16:47 ` Timothy J. Luoma
1996-07-11 17:51 ` On the topic of prompts DeWitt Clinton
1996-07-11 23:00 ` Bart Schaefer [this message]
1996-07-12 18:36 ` Jose Unpingco
1996-07-13 2:42 ` Bart Schaefer
1996-07-16 6:25 ` Nikita Borisov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=960711160041.ZM10008@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--cc=dewitt@siva.tripod.com \
--cc=schaefer@nbn.com \
--cc=zsh-users@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).