zsh-workers
 help / color / mirror / code / Atom feed
* can this be done?
@ 1995-07-18 20:16 Soren Dayton
  1995-07-20  6:01 ` Andrew J Cosgriff
  0 siblings, 1 reply; 3+ messages in thread
From: Soren Dayton @ 1995-07-18 20:16 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: application/pgp, Size: 567 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: can this be done?
  1995-07-18 20:16 can this be done? Soren Dayton
@ 1995-07-20  6:01 ` Andrew J Cosgriff
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew J Cosgriff @ 1995-07-20  6:01 UTC (permalink / raw)
  To: zsh-workers


Soren Dayton <csdayton@midway.uchicago.edu> wrote:

>Could you do something like display the current command line in a color?
>Note that this is _only_ the current line.

Here's my color prompt stuff again.

Current command line is in cyan.
POSTEDIT is set to turn text back to white afterwards...

--cut--
if [[ "$USE_COLOR" = "" ]] && [[ "$TERM" != "sun" ]]
then
  export USE_COLOR=yes
else
  export USE_COLOR=${USE_COLOR:-no}
fi

#
# Prompt stuff
#
PS2='%(4_.\.\.\. .)%3_> %E'

function precmd
{
  # Look at exit status of last command - attach appropriate signal
  # if it was a signal that caused it.
  local exitstatus=$? 
  if [[ $exitstatus -ge 128 ]]
  then
    psvar[1]=" $signals[$exitstatus-127]"
  else
    psvar[1]=""
  fi
  if [[ -o interactive ]]
  then
    jobs -l
  fi
}

HOSTVER=`uname -r`
[[ $HOSTTYPE = sun4 || $HOSTTYPE = solaris2.3]] && HOSTARCH=`arch -k` || 
HOSTARC
H=$HOSTTYPE

function prompt-mode ()
{
  case $1
  {
    all | ALL | on | ON)
        prompt="$date_prompt
$dir_prompt
$main_prompt" ;;
    dir | DIR)
        prompt="$dir_prompt
$main_prompt" ;;
    date | DATE)
        prompt="$date_prompt
$main_prompt" ;;
    off | OFF)
      prompt="$main_prompt" ;;
  right|RIGHT)
    RPS1="$right_prompt";;
  noright|NORIGHT)
    RPS1="";;
    *)
      echo "Syntax : $0 [on|off|all|dir]
  on|all : Turn on the full prompt.
  dir    : Show the current directory line.
  date   : Show the date line.
  off    : history line only.
  right : turn on right prompt.
  noright : turn off right prompt" ;;
  }
}
alias prm=prompt-mode

if [[ $USE_COLOR = yes ]]
then
 ]] && export COLOR_HILIT="1;"
[[ $TERM = vs100 ]]  && unset COLOR_HILIT
date_prompt="%{ESC[${COLOR_HILIT}31m%}[%{ESC[36m%}%D{%a %y/%m/%d %R 
%Z}%{ESC[31m
%}][%{ESC[32m%}tty%l%{ESC[31m%}][%{ESC[36m%}${HOSTARCH}/${HOSTVER}%{ESC[31m%}]"
dir_prompt="%{ESC[${COLOR_HILIT}31m%}<%{ESC[32m%}%n@%m%{ESC[37m%}:%{ESC[33m%}%~
%
{ESC[31m%}>%{ESC[0m%}"
main_prompt="%{ESC[0m%}zsh%(2L./$SHLVL.) %B%h%b %(?..[%?%v] )%B%#%b 
%{ESC[0;36m%
}"

POSTEDIT="ESC[37;0m"

right_prompt="[%T]"
else
date_prompt="[%B%D{%a %y/%m/%d %R %Z}%b][tty%l][%B${HOSTARCH}/${HOSTVER}%b]"
dir_prompt="<%B%n@%m:%~%b>"
main_prompt="zsh%(2L./$SHLVL.) %B%h%b %(?..[%?%v] )%B%#%b "

right_prompt="[%T]"
fi

prompt-mode off
prompt-mode right

if [[ "$TERM" = "emacs" ]]
then
  export USE_COLOR=no
  prompt="%n@%m:%~
zsh(emacs) %h %(?..[%?%v] )%# "
fi
--end--

Enjoy,
 Andrew.
 - Andrew J. Cosgriff - andrew@unico.com.au - SysAdmin, UNICO Computer Systems.
 email fileserver : "send file help" as subject        PGP, MIME ok & preferred
"There are ten million stories in the Naked City, but no-one can remember
 which one is theirs..." (Laurie Anderson)

 - Andrew J. Cosgriff - andrew@unico.com.au - SysAdmin, UNICO Computer Systems.
 email fileserver : "send file help" as subject        PGP, MIME ok & preferred
"There are ten million stories in the Naked City, but no-one can remember
 which one is theirs..." (Laurie Anderson)



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Can this be done?
       [not found] <199606201951.OAA20489@vogon.test.sparcs>
@ 1996-06-20 20:43 ` Hrvoje Niksic
  0 siblings, 0 replies; 3+ messages in thread
From: Hrvoje Niksic @ 1996-06-20 20:43 UTC (permalink / raw)
  To: ZSH Workers Mailing List

Lee Eakin (leakin@test490.pac.sc.ti.com) wrote:
> zsh: can't find termcap info for xterm%myhost:0.0

I have a similar problem when telnet-ing from a misconfigured network,
with terminal-type dec-vt220 (instead of just vt220). Now I have in
.zlogin something like:
case "$TERM" in
   dec-vt*) TERM=vt100 ;;
   [...]
esac

but it still complains "can't find termcap info for dec-vt220" and
then works normally after the resetting in .z*.

-- 
hniksic@srce.hr              |  Student of electrical engineering
hniksic@fly.cc.fer.hr        |  University of Zagreb, Croatia
------------------------------------------------------------------
   Mime is a standard for waving your hands through the air, aimlessly,
while people stand around yawning.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1996-06-20 20:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-07-18 20:16 can this be done? Soren Dayton
1995-07-20  6:01 ` Andrew J Cosgriff
     [not found] <199606201951.OAA20489@vogon.test.sparcs>
1996-06-20 20:43 ` Can " Hrvoje Niksic

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).