Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > General

Reply
 
Thread Tools Display Modes
  #1  
Old 03-21-2006, 11:56 AM
ericdp's Avatar
ericdp ericdp is offline
Registered User
 
Join Date: Jan 2006
Location: Sammamish, WA
Posts: 15
Send a message via AIM to ericdp
Question Color Text

I use ksh88 as my shell. I'd really like to use ksh93, but that is a different story. So in my .profile I have:

PS1=''`whoami`'"@"$HOSTNAME:" "\[$PWD\] > '; export PS1

Which gets me:

name@machine: [/dir1/dir2] >

I would like to see that in one color. The text I am typing in a different color. Then the output text, i.e. normal text in a third color. Is this possible in CRT?



question 2:
I've set my screen to use FloralWhile/DarkCyan in XTerm emulation. But I'm not sure if that is the best emulation mode I should be using. I'd like to use vim, but I just can't seem to find the right settings.


Thanks.
Eric
Reply With Quote
  #2  
Old 03-22-2006, 08:47 AM
tnygren's Avatar
tnygren tnygren is offline
Registered User
 
Join Date: May 2005
Posts: 1,408
Hi Ericd,

I just want to make certain that I totally understand the coloring that you would like to see.

The prompt should be one color, text being type another and rest of the text a third.

Is that correct?

Is this how it displays when connected directly to the remote machine?

As for your second question, are the colors not appearing correctly in VIM?

If so, is 'ANSI' color enabled in the 'Emulation' sub-category under 'Terminal' in the 'Session Options'?

The 'Xterm' emulation should work fine with VIM.

If ANSI color was already enabled, could you send me a screen shot of how VIM is appearing?

Just include the screen shot in an email to support@vandyke.com. Just use 'ATTN: Teresa Forum Thread 1366' in the subject so that it will get to me.
__________________
Thanks,

Teresa

Teresa Nygren
Reply With Quote
  #3  
Old 10-23-2006, 09:46 AM
MrC MrC is offline
Registered User
 
Join Date: Mar 2004
Posts: 216
From Ericdp:
> recently you mentioned that you have a way of doing color within CRT.
> I am using ksh88 (not my choice, but I can't get the SAs to load ksh93).
> Could you help me? I too would like to use color to distinguish my various
> sessions.
>
> Thanks
> Eric

Eric,

You can add color by setting your term type to one that supports color. I'm using xterm for this. Here's a sample prompt setting that will give you color:

PS1="^[[1;33m$LOGNAME@$HOSTNAME: [$PWD] >^[[0;32m "
export PS1

The ^[ are literal escape characters. You enter those in the vi/vim with a control V followed by the Escape key. Your prompt will look something like:

MrC@glacier: [/home/MrC] > pwd
/home/MrC


The 33 is the fourth color in the ANSI colors (0 based, 0-7) as set in your Global Settings. 32 is green (third color in the ANSI colors).

There is no way to differentiate between input and output in the shell. Its all just text.

For VIM, you need to enable syntax highlighting. Once in VIM, type:

:syntax on

and see if this helps.
Reply With Quote
  #4  
Old 10-24-2006, 12:06 PM
ericdp's Avatar
ericdp ericdp is offline
Registered User
 
Join Date: Jan 2006
Location: Sammamish, WA
Posts: 15
Send a message via AIM to ericdp
still no luck

with ANSIColor check on


(e0110054@lfs8401q) /ldaphome/e0110054>PS1="^[[1;33m$LOGNAME@$HOSTNAME: [$PWD] >^[[0;32m "
^[[1;33me0110054@: [/ldaphome/e0110054] >^[[0;32m



Doesn't look like I'll be able to use color in the prompt.

Eric
Reply With Quote
  #5  
Old 10-24-2006, 04:47 PM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,040
It looks like the escape characters weren't accepted. However, along the same lines MrC suggested, try replacing the escape character "^[" with the octal value for escape \033:
export PS1="\033[1;33m$LOGNAME@$HOSTNAME: [$PWD] >\033[0;32m "
Here is a website with some other dotfiles you might be able to use as examples:
http://www.dotfiles.com/index.php?app_id=5
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote
  #6  
Old 10-25-2006, 09:57 AM
ericdp's Avatar
ericdp ericdp is offline
Registered User
 
Join Date: Jan 2006
Location: Sammamish, WA
Posts: 15
Send a message via AIM to ericdp
not interpreting esc

Still no go.


(e0110054@lfs6411q) /ldaphome/e0110054>export PS1="\033[1;33m$LOGNAME@$HOSTNAME: [$PWD] >\033[0;32m "
033[1;33me0110054@: [/ldaphome/e0110054] >033[0;32m


I guess I'm stuck with monocolor text.

Eric
Reply With Quote
  #7  
Old 10-25-2006, 11:32 AM
ericdp's Avatar
ericdp ericdp is offline
Registered User
 
Join Date: Jan 2006
Location: Sammamish, WA
Posts: 15
Send a message via AIM to ericdp
Thumbs up Finally go it

Ok, finally I found the clue to solving this. the \e or \033 values for ESC do not work. You must edit a file (I use vi), enter ctrl-v then hit the ESC key. This will create the ^[ single chararacter.


export reset='^[[0m'
export black='^[[0;30m'
export red='^[[0;31m'
export green='^[[0;32m'



echo $red This is a test $green and some more $reset
This is a test and some more


next step to set up commands like
alias ll=echo $yellow;ls -alF;echo $reset

Thanks for the help. Just took me a while to find the trick to create and use the ESC character. Why the other alternatives don't work, I don't know.

Eric
Reply With Quote
  #8  
Old 10-25-2006, 11:42 AM
MrC MrC is offline
Registered User
 
Join Date: Mar 2004
Posts: 216
Excellent!

I didn't think \e or \033 would work in your old'ish ksh, and that's why I had mentioned to use the escaped Escape char. Newer shells are more elegant in how they handle prompts.

Glad its working.
Reply With Quote
  #9  
Old 10-25-2006, 12:47 PM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,040
Eric,

Thanks for the follow up message and persistence - glad to see your colors

Many shells allow you to press Ctrl-V (and release the keys) then press the ESC key and see ^[ appear as a single character, as well as letting you do things like: echo -ne "\033[0;33m hello ". I'm not sure why the vi editor would be necessary, but it looks like MrC saw the solution to this question pretty clearly.
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 05:43 PM.