LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 07-23-2006, 07:34 PM   #1
gdeward
LQ Newbie
 
Registered: Jul 2006
Location: Earth (for now)
Distribution: Ubuntu v6.06 LTS
Posts: 14

Rep: Reputation: 0
Unhappy Enabling colors for C++ in VIM


Can someone give me a rather idiot-proof way of enabling colors in the console version of VIM? I've read through a few "how to" examples and it just isn't working. More specifically, I'd like to have some type of highlighting for C++ as I'm going through these tutorials.

~ Greg
 
Old 07-23-2006, 10:06 PM   #2
taylor_venable
Member
 
Registered: Jun 2005
Location: Indiana, USA
Distribution: OpenBSD, Ubuntu
Posts: 892

Rep: Reputation: 41
First try just calling ":syntax on" inside Vim. (Or adding ":syntax on" to the end of your .vimrc file.) If that doesn't do it, then what kind of terminal emulator are your running? If you're using a terminal emulator like xterm, gnome-terminal, or konsole then in most situations it's as easy as setting the TERM environment variable to "xterm-color" and then using ":syntax on" once you're inside Vim.

If syntax highlighting works, but not for C++, I'm not sure what the problem could be. You have to name your source files with a C++ extension like .cpp or .cc but beyond that I don't know.

Last edited by taylor_venable; 07-23-2006 at 10:08 PM. Reason: Added last stanza.
 
Old 07-24-2006, 06:00 AM   #3
gdeward
LQ Newbie
 
Registered: Jul 2006
Location: Earth (for now)
Distribution: Ubuntu v6.06 LTS
Posts: 14

Original Poster
Rep: Reputation: 0
Yeah, I have tried that. The ":syntax on" command appears to work as VIM doesn't produce any errors. Also, the terminal emulator that I am using DOES display colors since Ubuntu itself is showing colors for the console prompt, file listings, etc. However, when I open any C++ file (e.g. "test.cpp") there are no colors displayed.

Any ideas?

~ Greg
 
  


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
vim colors fw12 Linux - General 5 07-02-2006 11:49 PM
having colors in C programming with vim Samoth Suse/Novell 3 04-27-2006 09:59 AM
what controls colors in vi/vim? pfaendtner Linux - Software 3 03-24-2005 05:51 PM
regarding colors in vim and emacs pranith Linux - Newbie 0 02-10-2005 03:10 AM
vim colors Erik Thorsson Debian 1 02-09-2005 09:38 AM


All times are GMT -5. The time now is 07:34 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration