LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   RdHat Vim Syntax Highlighting (https://www.linuxquestions.org/questions/linux-software-2/rdhat-vim-syntax-highlighting-272981/)

R4z0r 01-02-2005 01:21 PM

RdHat Vim Syntax Highlighting
 
Hi All,

I can't seem to enable syntax highlighting on my RedHat Enterprise Linux (CentOS) box.

Usually, I'd just type :syntax on in vim but this doesn't seem to work on the version I have with RedHat.

/usr/share/vim/vim62/syntax/syntax.vim

Is present but it still won't work.

I am ssh'ng in from a Windows box using PuTTY. I know color is working as I get colors with "ls".

Any ideas?

R4z0r 01-03-2005 05:04 AM

Anyone? Surely this can't be too tricky a request. AFAICS, I've followed exactly as it says in the man page so is this a known issue with RH?

anand_kt 01-03-2005 06:14 AM

you can probable check for aliases for vim..cos vim by default has colors enabled in Ent2wk edition of redhat

R4z0r 01-03-2005 07:57 AM

vi is aliased to vim in RH. I can verify this by running "vi" and it will start with the vim screen.

LinuxGeek 01-03-2005 10:07 AM

I'm not sure, but do you have the vim-enhanced package installed? Run:

Code:

rpm -qa | grep vim
and tell us what it outputs.

R4z0r 01-03-2005 12:23 PM

I didn't have vim-enhanced installed so I've just installed it.

Now, when I type "vim" I get some color (<Enter> is in blue on the title screen). As soon as I open some Perl up though, nothing is highlighted. I try typing ":syntax on" and it just accepts it (No error) but it won't highlight anythign"

Code:

[root@mail perl]# rpm -qa | grep vim
vim-common-6.2.98-1
vim-enhanced-6.2.98-1
vim-minimal-6.2.98-1

OK, I just tried ":color on" and I get:

E185: Cannot find color scheme on

I think syntax may be working as when I search for things it highlights them all but it just wont highlight my code.

Any ideas about that error I get? Google shows nothing (In English) and I can't even find the word "color" in the man page for vim!

LinuxGeek 01-04-2005 02:13 AM

To find out more about color, do:
Code:

        :help color
Try doing the following:

Code:

        :cal SetSyn("perl")
If you want to change the colorscheme, do:

Code:

        :colorscheme <TAB>
The <TAB> will let you tab through the installed colorschemes.

R4z0r 01-05-2005 12:06 PM

Thanks for the advice but nothings worked with it. It just moans about command not found and the color command doesn't understand <TAB>.

I think RedHat have customised it quite a lot and I've given up trying to undo it all.

I've just removed all the vim RPM's and compiled the lattest version from source - it's now working perfectly :)

rmanola 09-06-2011 01:22 PM

6 Years have passed and this same problem happens on centOS too.

It turns out that the vim command points to:
/bin/vim

If you do a ls -lah /bin/vim:
lrwxrwxrwx 1 root root 7 Jun 15 2010 /bin/vim -> /bin/vi

In other words, every time you type "vim", actually it uses vi!

There are two ways of fixing this:
  • rm -rf /bin/vim
  • cat "alias vim='/usr/bin/vim'" >> ~/.bashrc

Also make sure you have installed vim-enhanced.

Best regards.


All times are GMT -5. The time now is 09:20 AM.