LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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, 09:36 PM   #1
packets
Member
 
Registered: Oct 2005
Posts: 308

Rep: Reputation: 30
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, 10:16 PM   #2
speck
Member
 
Registered: Nov 2001
Location: US
Distribution: Slackware 14.2
Posts: 341

Rep: Reputation: 83
Add "syntax on" (without the double quotes) to your $HOME/.vimrc file.
 
Old 02-26-2008, 10: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, 10:41 PM   #4
packets
Member
 
Registered: Oct 2005
Posts: 308

Original Poster
Rep: Reputation: 30
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, 10:47 PM   #5
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Jessie 8.4
Posts: 5,873

Rep: Reputation: 348Reputation: 348Reputation: 348Reputation: 348
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, 11:22 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
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-27-2008, 12:04 AM   #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, 01:51 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
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, 02:04 AM   #9
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Jessie 8.4
Posts: 5,873

Rep: Reputation: 348Reputation: 348Reputation: 348Reputation: 348
/opt is the Suse default location for vim (as of Suse 9.3 Pro at any rate).
 
Old 02-27-2008, 02: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 02:42 AM. Reason: just remembered kvim
 
Old 02-27-2008, 07: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, 07: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 04:10 PM
How to enable color syntax when I start vim? ArthurHuang SUSE / openSUSE 5 01-27-2006 12:10 AM
[COLOR=red]ENCORE WIRELESS PCI Card 802.11b [/COLOR] enrique145 Linux - Hardware 3 07-07-2004 03:31 PM
bsetroot -gradient texture -from color -to color patpawlowski Linux - General 3 02-10-2004 02:51 PM
[COLOR=seagreen]HELP-want to use Kickstart/rh7.2 on a notebook[/COLOR] verbali Linux - Newbie 1 05-13-2002 02:59 PM


All times are GMT -5. The time now is 06:37 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration