LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-19-2007, 08:47 PM   #1
JMJ_coder
Member
 
Registered: Apr 2006
Distribution: Fedora
Posts: 478

Rep: Reputation: 30
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
 
Old 10-19-2007, 09:11 PM   #2
AceofSpades19
Senior Member
 
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079

Rep: Reputation: 57
Does it still compile properly?
 
Old 10-19-2007, 10:31 PM   #3
angrybanana
Member
 
Registered: Oct 2003
Distribution: Archlinux
Posts: 147

Rep: Reputation: 21
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

Last edited by angrybanana; 10-19-2007 at 10:34 PM.
 
Old 10-22-2007, 05:20 AM   #4
JMJ_coder
Member
 
Registered: Apr 2006
Distribution: Fedora
Posts: 478

Original Poster
Rep: Reputation: 30
Hello,

Quote:
Originally Posted by AceofSpades19 View Post
Does it still compile properly?
It compiles fine.
 
Old 10-22-2007, 05:21 AM   #5
JMJ_coder
Member
 
Registered: Apr 2006
Distribution: Fedora
Posts: 478

Original Poster
Rep: Reputation: 30
Hello,

Quote:
Originally Posted by angrybanana View Post
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.
 
  


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
Which language? scuffell Programming 1 07-01-2004 08:17 PM
Editor for Java programming language. ICO Linux - Software 11 02-03-2004 07:14 PM
Second language quietguy47 General 45 10-15-2003 02:02 AM
What language? BajaNick Programming 3 07-15-2003 03:17 AM
Which language is best? awdoyle Programming 16 03-23-2003 07:34 PM


All times are GMT -5. The time now is 06:14 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