texts in a cpp file are highlighted as comments while they are not comments

19 views
Skip to first unread message

Henrik Lin

unread,
Sep 18, 2023, 2:31:31 AM9/18/23
to v...@vim.org
image.png


As show in the picture, my texts are highlighted as comments

The OS is windows, vim version 8.2

 

Note: I also checked the texts are not within /**/


anything wrong with vim setting / encoding ?




--
linkedin : https://www.linkedin.com/in/henriklin
Skype : popoblue0222
(M) +1 437 971 2055

Christian Brabandt

unread,
Sep 18, 2023, 3:57:15 AM9/18/23
to vim...@googlegroups.com, v...@vim.org

On Sa, 16 Sep 2023, Henrik Lin wrote:

> image.png
>
>
> As show in the picture, my texts are highlighted as comments
>
> The OS is windows, vim version 8.2
>
>  
>
> Note: I also checked the texts are not within /**/
>
>
> anything wrong with vim setting / encoding ?

It looks like you have `:set hls` enabled and pressed '*' on the text
`*` in the file.

See if the highlighting goes away with `:set nohls`

Best,
Christian
--
If the human brain were so simple that we could understand it,
we would be so simple we couldn't.

Eike Rathke

unread,
Sep 22, 2023, 8:31:15 AM9/22/23
to vim...@googlegroups.com, v...@vim.org
Hi Henrik,

On Saturday, 2023-09-16 05:21:47 -0400, Henrik Lin wrote:

> As show in the picture, my texts are highlighted as comments
> The OS is windows, vim version 8.2
>
> Note: I also checked the texts are not within /**/

Obviously that text is not C++ code, so it must be either comments but
if it's not within /**/ then maybe it's a block surrounded by

#if 0
...
#endif

Such block is displayed in comment highlighting as well because it is
not active code.

Or the file abuses the .cpp file extension and highlighting is confused.

Eike

--
OpenPGP/GnuPG encrypted mail preferred in all private communication.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918 630B 6A6C D5B7 6563 2D3A
Use LibreOffice! https://www.libreoffice.org/
signature.asc
Reply all
Reply to author
Forward
0 new messages