In my C++ code vim shows red highlighted brackets in the following piece:
This is some in-built functionality as I tried removing .vimrc, but it still shows them red. What's going on and how to fix it?
For example, vim can understand comments and highlight those texts in blue color and variables in green, etc… Similarly, errors are generally highlighted in red color and it looks like vim does not know how the syntax should be handled for /etc/sysconfig/named .
This means that the local parser has detected an unbalanced order of curly braces or parentheses. It's not perfect, however, as it can occasionally get confused, but it usually gets it right, and there may be compilation errors.
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.
Vim has only very limited C++ syntax highlighting capability built in. There is currently no support for C++11.
But there are, of course, plugins! Here's one that makes the error go away:
C++11 Syntax Support: A port of the existing C++ syntax to allow for C++11 features
To install, download the archive and extract the files into your ~/.vim/syntax
directory. Enable the C++11 file type with :setf cpp11
or follow the instructions on the plugin home page.
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