LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   shell color syntax/highlighting on FC4 (https://www.linuxquestions.org/questions/linux-general-1/shell-color-syntax-highlighting-on-fc4-351002/)

kz26 08-07-2005 10:33 PM

shell color syntax/highlighting on FC4
 
I am running a Fedora Core 4 box with a tcsh shell. Everything works fine, except for one thing.

On Red Hat Linux 9 there used to be color highlighting in vi and also when you called up a man page.

On Fedora Core 4, however, instead of color, I get just ugly bold black/white letters when there
should be color.

I have already tried 'setenv TERM xterm-color' from the vi docs - while this fixes vi,
man pages, pine, etc. still do not have color.

While this may not be a bug, I have a strong personal preference for this. Anyone have
any fixes?

Simon Bridge 08-08-2005 02:24 AM

In RH9 you would alter the .bashrc file in your home directory, adding the following at the end:[code]alias ls='ls _color=auto'

for the ls command to show files in colour.
(And, globally, you put it in /etc/bashrc.)

Of course - this was for the (default) bash shell. And only worked for ls.

The man page for tcsh is quite exhaustive. There is advice under LS_COLORS which should help with man pages.

but: in my FC4 system, I can modify the terminal parameters by selecting edit > current profile ... so long as colours are turned on everything is in colour.

kz26 08-08-2005 08:05 AM

I am using xterm... in 'ls' there's color by default, and I got color in vi sort of working,
but in everything else there's no color.

kz26 08-08-2005 01:48 PM

Let me elaborate... colors in 'ls' work fine - but when I use vi to create a new file in xterm, the tilts (~) that represent blank lines are in color (blue), but when, say, I press 'i' for insert or 'R' for replace, the vi statusbar at the bottom of my xterm is still an ugly bold black color.

Additionally, when I call up a man page, instead of colors, I get bold black.

Also in pine, I had colored (blue) links in my messages on RH9. Again, on FC4, I only
get bold black text instead of color.

This seems like an odd issue (the color and highlighting were fully working on FC2,
but has stopped working for me on FC3 and 4.

Additionally, this issue doesn't only affect the tcsh shell - bash also has this problem.

Again, any help would great help me (and my eyes). :cry:

Simon Bridge 08-09-2005 03:40 AM

Did you try altering the profile colours from the gui?
(Try the obvious first...)

My FC4 has all the colours working by default ... I have altered the profile colours so the background is "transparent" and the text is in grey. Boldface is white. vi and so on all show proper colours.

/etc/bashrc contains the bash settings. This is what mine contains:
Code:

# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# by default, we want this to get set.
# Even for non-interactive, non-login shells.
if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then
        umask 002
else
        umask 022
fi

# are we an interactive shell?
if [ "$PS1" ]; then
    case $TERM in
        xterm*)
                if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
                        PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
                else
                PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
                fi
                ;;
        screen)
                if [ -e /etc/sysconfig/bash-prompt-screen ]; then
                        PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
                else
                PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\033\\"'
                fi
                ;;
        *)
                [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
            ;;
    esac
    # Turn on checkwinsize
    shopt -s checkwinsize
    [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
fi

if ! shopt -q login_shell ; then # We're not a login shell
        for i in /etc/profile.d/*.sh; do
            if [ -r "$i" ]; then
                . $i
            fi
        done
        unset i
fi
# vim:ts=4:sw=4

# alias interactive [mjm-modification]
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'


kz26 08-09-2005 02:06 PM

Simon, I tried using your bashrc file and my problem is still there. What do you mean by alternating the colors in the GUI? I am using xterm, not gnome-terminal.

BTW, this problem exists in both the bash and tcsh shells, if that helps. I tried setting my TERM variable to a bunch of different settings, but it had no effect.

jayemef 08-09-2005 10:46 PM

To enable syntax colors/highlighting in Vi, try creating/editing ~/.vimrc and adding the line
Code:

syntax enable
Save and exit. You should now have color in Vi.

kz26 08-10-2005 10:38 PM

I posted 2 pics of my problem.

--EDIT-- URLs updated
Screen1
Screen2
--EDIT--

As you can see from the first screenshot, I have colors in vi, but the statusbar at
the bottom is still black.

The 2nd screenshot shows a man page - as you can see, there is no color at all.

Under RH9, I had full color in both.

jayemef 08-10-2005 10:47 PM

Sorry, I can't see your screenshots. I'm getting forwarded to an ad page. But if you aren't getting a status line in Vi, add the following to your ~/.vimrc file:
Code:

set ruler
Additionally, you can play with
Code:

set statusline=...........  " Specify what you want to include in your status line
set laststatus=2  " Always show the status line


kz26 08-11-2005 01:31 PM

Picture URLs updated, please check the post again...

Simon Bridge 08-11-2005 07:54 PM

OK - I think I see your problem.

Was the background always yellow or did you adjust that yourself?

The man pages are supposed to be monochrome. They were that way for me in RH9, and FC2 as well as FC4. Though I think you can set the highlight and boldface colour as something different ... this is done for the terminal config. Just like the background colour.

see the xterm man pages --- of just use gnome terminal.

kz26 08-11-2005 10:31 PM

I set the window background to yellow on purpose - I like different-colored windows.

If I wanted different-colored text in the man pages, how would I set the highlight and boldface
colors for xterm?

Ugat 08-11-2005 11:48 PM

I agree to:Pengy:

Simon Bridge 08-12-2005 06:10 AM

OK - I am using FC4, but I am using the gnome console.

From the console menue, I can select:
edit>profiles>myprofile>colors

I have selected a built in scheme for normal text (grey on black). In this setting, normal text is grey (doh!) and highlighted text is white. I've selected a transparent background and set transparency at about 30% ... so I see this against a dim version of my desktop wallpaper.

I can also cutomise the colour scheme if I want to - say to crimson on clover?

In the man pages, the "highlight" is the same colour as the text only darker for light backgrounds and lighter for dark backgrounds.

(To see why this may be, try this: man ls > ls.txt - then view ls.txt.)

There is also a colour pallette - with built in schemes and a custom option. eg. if you want the hyperlinks in lynx to be red while the text is browney-grey on a parchment coloured background ... then drag the pale yellow to the background tile, the pale brown to the foreground tile, and the crimson to the dark blue tile. e-voila. Of course, this is your encoding for everything using that terminal profile.

kz26 08-12-2005 08:00 AM

Ok, I'll try that. Would you happen to know the commandline switches to do the same
in xterm?


All times are GMT -5. The time now is 07:13 PM.