Why private
and public
inclass hold
is not highlighted?

- 301
- 4
- 16
-
2Your code won't compile, since you're missing semicolons (and other things). So the parser running in your IDE cannot correctly identify those keywords. – Tim Biegeleisen Nov 12 '15 at 09:24
-
Why wouldn't you complete writing the class and save the file using `w!` and see anything changes? – sjsam Nov 12 '15 at 10:25
-
@Smittey : that wouldn't make much sense. – sjsam Nov 12 '15 at 10:56
-
@TimBiegeleisen : IMHO the parser do not rely on the correct syntax for highlighting. Not sure though !! – sjsam Nov 12 '15 at 11:02
-
My apologies. I didn't read the question properly first time round :) I take it back – Smittey Nov 12 '15 at 11:28
1 Answers
First finish the programme, then save the file as a .cpp file with the following vim command :
w your_programme_name.cpp
Vim might be applying the current color settings. Try to override the current color settings with defaults using the below vim command :
syntax on
Occasionally though, I have seen vim getting confused on what to apply where. Below is the help text from Vim Documentation. This might be the last resort.
The colors are wrong when scrolling bottom to top. Vim doesn't read the whole file to parse the text. It starts parsing wherever you are viewing the file. That saves a lot of time, but sometimes the colors are wrong.
A simple fix is hitting CTRL-L.
Or scroll back a bit and then forward again.
For a real fix, see |:syn-sync|.
Some syntax files have a way to make it look further back, see the help for the specific syntax file. For example, |tex.vim| for the TeX syntax.

- 21,411
- 5
- 55
- 102