http://qs321.pair.com?node_id=234537

logan has asked for the wisdom of the Perl Monks concerning the following question:

Hello, Monks.

This is a tad off topic, but I don't know where else to turn. I've been writing perl scripts to run on Linux, Irix, and Solaris servers. When I'm using a Linux machine, I use vim with the vim.perl syntax module enabled, and life is wonderful. The color-coding makes the code more legible, and coding is just plain easier. Thing is, when I use a Solaris machine, my results are totally different. Syntax coloring is severely limited, and often doesn't work at all.

Here's the specifics of my environment: I'm using a Red Hat 7.3 box to telnet to various servers. If I use an xterm or gnome-terminal window, I get full syntax coloring from my Linux machines. Connecting to a Solaris machine through a gnome-terminal window, I get no syntax color. If I manually :set syntax, I see that some of the text is bolded, and some underlined, but it's all the same color. Using an xterm window to do the same thing, I get only 3 colors used for the syntax. The version of vim on the Linux machine is 6.1.165 and on Solaris it's 6.0.11.

In all cases, I'm using the same .exrc and vim.perl files, and the shell is tcsh. I've tried comparing $ENV and the output of 'set' on the Linux and Solaris machines, and can't see a smoking gun.

Why should gnome-terminal and xterm behave differently when connecting to the same machine? Why is there such a difference in the behavior of the syntax coloring on Solaris? Why should there be such a major change in functionality between the two versions?

I've tried vim.org, the O'Reilly vi book, Red Hat.com, and I googled until my fingers bled. I'm out of ideas, and totally baffled.

Has anyone else faced this? Can someone point me to a solution?

Thanks,

-Logan
"What do I want? I'm an American. I want more."

Repaired RH.com link at author's req. - dvergin 2003-02-12

Replies are listed 'Best First'.
Re: Perl syntax coloring using vim
by traveler (Parson) on Feb 11, 2003 at 22:14 UTC
    If I telnet to my Linux box I get similar behavior. I can fix it if I set the terminal type properly. Be sure that the TERM environment variable on Solaris accurately reflects a terminal with the most capabilities you have. Then start vim and do ":se all" (without the quotes) to see if vim's idea of the terminal jives with Solaris'.

    --traveler

      TERM! That's it! OK, I'm playing with setting the term variable. So far "sun-color" is the closest to "right". It will display the colors correctly, but doesn't redraw the screen. Nevertheless, I think I'm on the right track. Thanks!

      -Logan
      "What do I want? I'm an American. I want more."

        I ran across this one too.

        If i remember correctly, setting TERM=dtterm worked well enough for me.

        Let us know how it goes.

Re: Perl syntax coloring using vim
by logan (Curate) on Feb 12, 2003 at 00:23 UTC
    And the winner is....

    set term=beos-ansi

    I have no idea why something for Be OS should work best for Solaris, but I'm not aguing with success.

    I altered my .tcshrc file to include this section:

    setenv HOSTV `uname -s` if ("$HOSTV" =~ "SunOS") then echo HOSTV $HOSTV set term=beos-ansi if ( -f /usr/local/bin/gnu_ls) then alias ls '/usr/local/bin/gnu_ls --color' endif endif
    This way, the new settings should only affect Solaris machines, but I won't have to maintain more than one .tcshrc file.

    gnu_ls, btw, allows you to mimic Linux' 'ls --color' under Solaris.

    -Logan
    "What do I want? I'm an American. I want more."