LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Editor or Language? (https://www.linuxquestions.org/questions/programming-9/editor-or-language-593165/)

JMJ_coder 10-19-2007 08:47 PM

Editor or Language?
 
Hello,

I don't know if this is a peculiarity of the editor I am using - which is VIM 7.1.12 - or if it is the language itself - which is C++.

When I go to enter a piece of code with the std prefix - std::cout - when I enter std:, std lights up as a keyword. But when I enter the second colon, it goes back to being just plain. I don't know what to make of it.

Code:

std

std:

std::

std::cout


AceofSpades19 10-19-2007 09:11 PM

Does it still compile properly?

angrybanana 10-19-2007 10:31 PM

Vim does syntax highlighting by default. If you try to do it on a file that doesn't have a .c or .cpp extension It won't highlight it.

Syntax highlighting isn't perfect, so you might get some weird results every now and then. Doesn't mean you typed something wrong (at least with python it gives no indication). It usually tries to highlight built in commands and such (ex. print, for, while... again, this is in python).

If you wanna turn syntax highlighting off do:
Code:

:syntax off
If you want it always off, then turn it off in vimrc. Also you can enable and disable it for specific files.

Take a look at this for reference:
http://www.vim.org/htmldoc/syntax.html

JMJ_coder 10-22-2007 05:20 AM

Hello,

Quote:

Originally Posted by AceofSpades19 (Post 2930295)
Does it still compile properly?

It compiles fine.

JMJ_coder 10-22-2007 05:21 AM

Hello,

Quote:

Originally Posted by angrybanana (Post 2930333)
Vim does syntax highlighting by default. If you try to do it on a file that doesn't have a .c or .cpp extension It won't highlight it.

Syntax highlighting isn't perfect, so you might get some weird results every now and then. Doesn't mean you typed something wrong (at least with python it gives no indication). It usually tries to highlight built in commands and such (ex. print, for, while... again, this is in python).

If you wanna turn syntax highlighting off do:
Code:

:syntax off
If you want it always off, then turn it off in vimrc. Also you can enable and disable it for specific files.

Take a look at this for reference:
http://www.vim.org/htmldoc/syntax.html

That presumes I want to turn syntax highlighting off, which I don't. I just wanted to understand this seemingly unusual situation.


All times are GMT -5. The time now is 08:27 AM.