LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Enabling colors for C++ in VIM (https://www.linuxquestions.org/questions/programming-9/enabling-colors-for-c-in-vim-466921/)

gdeward 07-23-2006 07:34 PM

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

taylor_venable 07-23-2006 10:06 PM

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.

gdeward 07-24-2006 06:00 AM

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


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