I recently downloaded vim 8.0. I don't know if I messed something up or a default changed, but in this code...
int foo()
{
// This is a comment containing a "string" and the number 5.
return 42;
}
...the "string"
and 5
are in a different color. It's the same color as when they appear in normal code. I've never seen that before. How can I turn it off?
If you want to avoid this in an apache . conf file like I did, you can add it to the end, like "# vim: nospell". Or, you could add words to spelling dictionary. I have to do set nospell , every time that red happens!
After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.
This was unusually hard to search for, but the answer is in vim's help files. It's a feature of the syntax highlighting for C and C++ code that ships with vim. From :h ft-c-syntax
:
A few things in C highlighting are optional. To enable them assign any value to the respective variable. Example:
:let c_comment_strings = 1
To disable them use ":unlet". Example::unlet c_comment_strings
The c_comment_strings
variable controls the highlighting of strings, characters, and numbers inside of comments. It must have been enabled somewhere in my setup. If I :unlet
it, comments are all highlighted in one color again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With