LinuxQuestions.org
Register a domain and help support LQ
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 10-07-2005, 10:47 AM   #1
bsg
LQ Newbie
 
Registered: Jul 2005
Posts: 7

Rep: Reputation: 0
VIM Color Syntax Highliting


I installed vim on my system and was wondering how do I get that color syntax highlighting for certain files. Config files, perl, PHP, etc. Is this possible via ssh, cause right now i'm only seeing colors for my file listings.
 
Old 10-07-2005, 11:37 AM   #2
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 51
try creating a .vimrc file in your home directory. There is usually an example of this file in your vim package.
 
Old 10-07-2005, 12:39 PM   #3
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,014

Rep: Reputation: 115Reputation: 115
put "syn on" in your .vimrc
"set sw=3 tw=3 bs=2 expandtab ai" is good cause it makes shift width(for >>) 3 spaces, tabs are 3 spaces, lets you backspace beyond the original cursor, turns tabs into spaces, and auto indents.
 
1 members found this post helpful.
Old 10-07-2005, 08:35 PM   #4
bsg
LQ Newbie
 
Registered: Jul 2005
Posts: 7

Original Poster
Rep: Reputation: 0
Ok, i searched my system for vimrc exmaples and found one and copied it to my root as .vimrc.

Code:
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endif
It has this code in it which is apparently for color syntax highlighting but it's still not working...Either that if statement failed or something else is wrong. Could it be my ssh client (putty) settings? Also, if i ever do get this working, what kind of files will this syntax highlighting work for?

Last edited by bsg; 10-07-2005 at 08:39 PM.
 
Old 10-07-2005, 09:26 PM   #5
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 51
i suggest you copy the entire vimrc example and uncomment lines containing syntax on.
syntax will be available for many, many files :-)
 
Old 10-07-2005, 09:31 PM   #6
bsg
LQ Newbie
 
Registered: Jul 2005
Posts: 7

Original Poster
Rep: Reputation: 0
Actually the file isn't that big, and the only line with syntax on is the if block i pasted above...
Here is the only vimrc example i found with the package i just recently downloaded.

http://section31.us/temp/vimrc_example.vim
 
  


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
RdHat Vim Syntax Highlighting R4z0r Linux - Software 8 09-06-2011 02:22 PM
vim syntax highlighting MiniMe001 Linux - General 2 06-19-2005 12:08 PM
Adding Syntax Highlighting to VIM TastyWheat Linux - Software 2 02-27-2004 04:37 AM
How to make vim has syntax highlighting ICO Linux - General 4 01-05-2004 11:35 AM
Vim syntax highlighting NSKL Linux - Software 2 11-09-2002 03:39 AM


All times are GMT -5. The time now is 03:57 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration