LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-26-2008, 08:36 PM   #1
packets
Member
 
Registered: Oct 2005
Posts: 339

Rep: Reputation: 32
how to enable color in vi


I want to enable the color in my vi editor to easy capture words,etc. The problem is its not enabled. I tried to put .vimrc with "syntax enable" and tried to edit a text file but still doesn't work. I also edit /etc/vimrc and put "syntax enable".

Anyone knows how to activate it???
 
Old 02-26-2008, 09:16 PM   #2
speck
Member
 
Registered: Nov 2001
Location: US
Distribution: Slackware 14.2
Posts: 375

Rep: Reputation: 115Reputation: 115
Add "syntax on" (without the double quotes) to your $HOME/.vimrc file.
 
Old 02-26-2008, 09:17 PM   #3
vesperatus
Member
 
Registered: Feb 2004
Posts: 44

Rep: Reputation: 15
What flavor of linux do you have installed ?

I just realized that my centos 5 box doesnt have the syntax highlighting but my mandriva 2008 boxes has it by default. So far, the difference is in the arrangment of the directories. I'll get to bed and see if I can figure out more tomorrow.
 
Old 02-26-2008, 09:41 PM   #4
packets
Member
 
Registered: Oct 2005
Posts: 339

Original Poster
Rep: Reputation: 32
Still not working. I'm using Whitebox Linux. I put in the ~root/.vimrc the "syntax on" but still not working.
 
Old 02-26-2008, 09:47 PM   #5
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
The correct syntax is :syntax on (not the colon in front of the word syntax).

For color schemes,look in /opt/kde3/share/vim/vim62/colors/ for colorschemes. Add a line to .vimrc ;colorscheme murphy.vim (try each color scheme out to see which you like best).
 
Old 02-26-2008, 10:22 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
actually, in your '.vimrc' file in your home (login) dir add the lines

colorscheme delek
syntax enable


note no leading ':'. That's ( ':' )only needed when you invoke the same cmd from within vim ie from the 'cmd-line mode'.
And, definitely : not ; .
 
Old 02-26-2008, 11:04 PM   #7
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
/opt/kde3/share/vim/vim62/colors/? That's a weird place for vim color schemes and is obviously version dependent as well as distro dependent.

I wouldn't be surprised, running an 'enterprise distro' like centos, if you were running some 'vim.tiny' sort of thing and, if you're issuing the 'vi' command, who knows what you're running, but probably nvi which has no syntax highlighting. So I'd check the :version of my vim and make sure it had +syntax.

Another thing to think about is maybe a screwed up TERM setting.
 
Old 02-27-2008, 12:51 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
I don't know for sure, but in Whitebox/Centos (ie RHEL) vi may very well be the real thing ie vi = vi (the orig Unix console monochrome only editor).
On most Linux distros, the cmd vi is symlinked to vim, which does have colour etc.
If someone has added vim as an extra, /opt is a reasonable place to put it.
 
Old 02-27-2008, 01:04 AM   #9
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
/opt is the Suse default location for vim (as of Suse 9.3 Pro at any rate).
 
Old 02-27-2008, 01:40 AM   #10
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Quote:
Originally Posted by bigrigdriver View Post
/opt is the Suse default location for vim (as of Suse 9.3 Pro at any rate).
But /opt/kde3/? No big deal - if that's where it is, that's where it is. Just sounded strange.

-- Actually, I just remembered that there used to be a 'kvim' which was a sort of integration of vim and kde, turning it into a 'kpart', so that actually may make more sense than I was thinking.

Quote:
Originally Posted by chrism01 View Post
I don't know for sure, but in Whitebox/Centos (ie RHEL) vi may very well be the real thing ie vi = vi (the orig Unix console monochrome only editor).
On most Linux distros, the cmd vi is symlinked to vim, which does have colour etc.
If someone has added vim as an extra, /opt is a reasonable place to put it.
I already mentioned nvi. There isn't really a 'real thing' but nvi is about as close as you'll get.

Last edited by slakmagik; 02-27-2008 at 01:42 AM. Reason: just remembered kvim
 
Old 02-27-2008, 06:15 AM   #11
vesperatus
Member
 
Registered: Feb 2004
Posts: 44

Rep: Reputation: 15
Quote:
Originally Posted by chrism01 View Post
I don't know for sure, but in Whitebox/Centos (ie RHEL) vi may very well be the real thing ie vi = vi (the orig Unix console monochrome only editor).
On most Linux distros, the cmd vi is symlinked to vim, which does have colour etc.
If someone has added vim as an extra, /opt is a reasonable place to put it.
HaHA !

That helped me figure out why I didnt had syntax highlighting in my vi/vim on my CentOS 5 box. In fact, I didnt had the colors when I was root but had them on my user account.
The explanation follows :

Code:
[Phil@krumcrush ~]$ which vi
alias vi='vim'
        /usr/bin/vim
[Phil@krumcrush ~]$ su root
Password:
[root@krumcrush Phil]# which vi
/bin/vi
 
Old 02-27-2008, 06:20 AM   #12
harsshal
Member
 
Registered: Jul 2006
Location: New York, NY
Distribution: redhat,ubuntu,RHEL,fedora,centOS
Posts: 105

Rep: Reputation: 15
syn on

you can try "syn on" in vimrc.

but the fact is if you dont have the support u can try anything,it wont work...
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
REQ: Gimp plugin fo automatic color correction and color masks Rick069 Linux - Software 1 04-15-2007 03:10 PM
How to enable color syntax when I start vim? ArthurHuang SUSE / openSUSE 5 01-26-2006 11:10 PM
[COLOR=red]ENCORE WIRELESS PCI Card 802.11b [/COLOR] enrique145 Linux - Hardware 3 07-07-2004 02:31 PM
bsetroot -gradient texture -from color -to color patpawlowski Linux - General 3 02-10-2004 01:51 PM
[COLOR=seagreen]HELP-want to use Kickstart/rh7.2 on a notebook[/COLOR] verbali Linux - Newbie 1 05-13-2002 01:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration