Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 07-23-2006, 07:34 PM   #1
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
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
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


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 / openSUSE 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 03:32 PM.

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