Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Color in vim /shell : TERM, Emulation, and SecureCRT

616 views
Skip to first unread message

Rahul

unread,
Mar 20, 2008, 12:45:34 PM3/20/08
to
I was a bit confused about setting colors on my Linux session. All this
years I was working on a plain vanilla Black and White shell and I was
thinking of adding some color for syntax highlighting in (a) the console
itself (b) vim.

In general I've succeeded (I have color highlights in my shell listings and
vi) but there are some small wrinkles that I wanted to iron out.

1. If I don't explicitly set TERM it defaults to vt100 in my shell. Should
I change it explicitly. I played with linux, xterm-color etc. and all seem
to work in their own ways. Sometimes though the number-key mapping gets
messed up. One setting led to this super-strange behaviors where the num-
keys mapped to x,y etc. BUT only within vim.

2. My secure CRT Client seems to offer about 6 "terminals" under Emulation
(vt100, vt220, linux, xterm etc.)

3. To make things more complicated it also has a separate "Color Schemes"
Tab with stuff like "Floral", "Windows" etc.

How do all of these components interact? Is there a preferred way of doing
things that people might recommend from experience? My only *strong*
preference is a "dark on white" scheme (ergonomics!).

I experimented and some combinations lead to really strange behavior.
Sometimes its a single color thats strange. Where should I try customizing
it then. On the shell side or in my SecCRT emulator?


--
Rahul

Dances With Crows

unread,
Mar 20, 2008, 1:35:28 PM3/20/08
to
Rahul staggered into the Black Sun and said:
> I was a bit confused about setting colors on my Linux session. In

> general I've succeeded (I have color highlights in my shell listings
> and vi) but there are some small wrinkles that I wanted to iron out.
>
> If I don't explicitly set TERM it defaults to vt100 in my shell.
> Should I change it explicitly?

TERM should be set. In general, the terminal emulator takes care of
that, but if you're using agetty on a VC, TERM will be set to linux.
Are your /etc/profile or ~/.bashrc or ~/.profile or /etc/bash/bashrc
files setting TERM explicitly? None of those files sets TERM on my
setup, so TERM is derived from what my terminal emulator reports.

> I played with linux, xterm-color etc. and all seem to work in their

> own ways. Sometimes, the number-key mapping gets messed up. One


> setting led to this super-strange behaviors where the num- keys mapped
> to x,y etc. BUT only within vim.
>

> My secureCRT client seems to offer about 6 "terminals" under Emulation


> (vt100, vt220, linux, xterm etc.)

xterm is the default for most things. If you don't have special needs,
you probably want to set that to xterm and fuggeddabouttit.

> To make things more complicated it also has a separate "Color Schemes"

> tab with stuff like "Floral", "Windows" etc. How do all of these
> components interact?

Color schemes affect what RRGGBB values are displayed for the 16 colors
that are pretty much guaranteed to be there in xterm. If I send the
code \e[01;34m , that sets the foreground color to bright blue. My
color scheme displays that as 0x5454ff . If I send the code \e[00;34m ,
that sets the foreground color to dark blue. My color scheme displays
that as 0x1818b2 . You display some text that has a fair number of
colors in it, then you go through each color scheme and pick one that
looks good to you. (And then you hand-hack it a bit, because usually
the blue colors are too dark.)

> My only *strong* preference is a "dark on white" scheme (ergonomics!).

Most good terminal emulators have one of those.

> I experimented and some combinations lead to really strange behavior.

> Sometimes [it's] a single color [that's] strange. Where should I try


> customizing it then. On the shell side or in my SecCRT emulator?

Customize the colors in your emulator. *Most* terminal apps assume that
there are only 16 colors to choose from on a color terminal (8
foreground, 8 background) even though the xterm standard defines an
extension that lets you use many more colors.

--
I think I'll have to put on 500 pounds of subwoofers, amps, and other
delicious herbs. --MegaHAL, trained on ASR
My blog and resume: http://crow202.dyndns.org:8080/wordpress/
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see

Rahul

unread,
Mar 21, 2008, 5:14:59 PM3/21/08
to
Dances With Crows <dancesw...@usa.net> wrote in
news:slrnfu5822.8h7....@crow202.dyndns.org:


> TERM should be set. In general, the terminal emulator takes care of
> that, but if you're using agetty on a VC, TERM will be set to linux.
> Are your /etc/profile or ~/.bashrc or ~/.profile or /etc/bash/bashrc
> files setting TERM explicitly? None of those files sets TERM on my
> setup, so TERM is derived from what my terminal emulator reports.

I set it explicitly now to xterm now. Thanks for those tips again!

--
Rahul

Dan Stromberg

unread,
Mar 25, 2008, 3:13:43 PM3/25/08
to

Just try to get a matching pair - what SecureCRT says it does, and what
your $TERM is telling applications to send to SecureCRT.

Basically, the terminal emulator (SecureCRT in your case) will accept a
set of escape sequences, and $TERM tells applications to look up matching
(hopefully) escape sequences in the terminfo or termcap databases.

If you want to see the escape sequences, try running "script /tmp/foo",
running some curses-based applications, typing "exit" to get out of the
script, and then use your favorite text editor to look at /tmp/foo.
Those escape sequences are being used by the applications and your
terminal emulator to agree on things like cursor position, clearing the
screen, setting colors, etc.

If you want color, pick an emulation that supports color. The colors in
SecureCRT may be orthogonal to the terminal emulation, but I'm not sure -
I'm much more of an mrxvt person than a SecureCRT person. mrxvt does run
on windows, BTW - it isn't *ix only, though ISTR it required cygwin and
perhaps X11 too.

I personally find "light on dark" more ergonomic - it's less like staring
at a light bulb.

Rahul

unread,
Mar 25, 2008, 3:35:28 PM3/25/08
to
Dan Stromberg <dstromb...@gmail.com> wrote in
news:H9cGj.5069$qT6...@nlpi070.nbdc.sbc.com:


> Just try to get a matching pair - what SecureCRT says it does, and
> what your $TERM is telling applications to send to SecureCRT.

That was my intention. Unfortunately it was hard to find a good terminal that
my Linux box had and secure-crt both supported. xterm-color (which seems to
be the recommendation of choice?) is unfortunately not present natively in
sec-crt. I tried setting sec-crt emulation to vt100 and so far have not faced
any problems. Except that vt100 seems to only handle 4 fn keys thereby
handicapping my ability to make more vim Key-maps.

Sec crt only seems to provide emulation for ANSI, Linux, xterm, vt100, vt220,
vt102, scoansi, wyse50, wyse60 and vshell.

>
> I personally find "light on dark" more ergonomic - it's less like
> staring at a light bulb.

You do have a point. Its mostly my personal preference I guess; although I'd
be curious to know if there are any scientific ergonomic recommendations
about it!

--
Rahul

0 new messages