zsh-users
 help / color / mirror / code / Atom feed
From: Dirus <Dirus@Programmer.net>
To: zsh-users@sunsite.dk
Subject: Simple prompt theme
Date: Sat, 31 May 2003 00:36:34 -0700	[thread overview]
Message-ID: <5.2.1.1.0.20030530233427.02681cc8@valenzud.inbox.email.arizona.edu> (raw)

I've made a simple prompt theme that displays "user@host:path>" by default 
in white but can accept up to two colors.  I use it with "cyan blue" but it 
looks good with "red yellow" too, maybe I shouldn't leave the default color 
white?  Anyway, it basically shows what the "redhat" and "suse" prompts do 
but in a way that still allows people to set colors to brighten up their 
prompt.  I'm not sure if I need this line, but the other themes seem to 
have it (now that's peer pressure!):
prompt_opts=( cr percent )

I hope it doesn't bother anyone if I paste it at the end of this email.  I 
could do a diff -u with an empty file but that doesn't make much sense.  I 
suppose it's a bit much of me to even think others might want to use it 
(but I'm proud of it), at least I didn't call it the dirus theme. ;)  I 
hope this is the right mailing list for it (I didn't know if I should post 
to workers or to users), and I hope no one minds the extra 2k in their inbox.

prompt_simple_setup:
# Created by Dirus

prompt_simple_help () {
   cat <<'EOF'
As it's name suggests, this prompt is designed to be small and to work
with all fonts, and yet still provide useful information.

This prompt is color-scheme-able.  You can invoke it thus:
   prompt simple [<text-color> [<punctuation-color>]]

The default color is just white and is intended to work on a black
background.  Simply use darker colors (such as black) for use on a
lighter background.
EOF
}

prompt_simple_setup () {
   local text_color=${1:-'white'}
   local _text="%{$fg_no_bold[$text_color]%}"
   local _other="%{$fg_bold[${2:-$text_color}]%}"

   PS1="$_text%n$_other@$_text%m$_other:$_text%~$_other>%{$reset_color%} "
   PS2="$_other>%{$reset_color%} "

   prompt_opts=( cr percent )
   precmd () { }
   preexec () { }
}

prompt_simple_preview () {
   if (( ! $#* )); then
     prompt_preview_theme simple
     print
     prompt_preview_theme simple green
     print
     prompt_preview_theme simple red yellow
     print
     prompt_preview_theme simple white yellow
     print
     prompt_preview_theme simple cyan blue
     print
     prompt_preview_theme simple green blue
   else
     prompt_preview_theme simple "$@"
   fi
}

prompt_simple_setup "$@"


             reply	other threads:[~2003-05-31  7:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-31  7:36 Dirus [this message]
     [not found] <5.2.1.1.0.20030530233427.02681cc8@valenzud.inbox.email.ari zona.edu>
2003-05-31  8:20 ` Dirus

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=5.2.1.1.0.20030530233427.02681cc8@valenzud.inbox.email.arizona.edu \
    --to=dirus@programmer.net \
    --cc=zsh-users@sunsite.dk \
    /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).