I use Vim version 8.2.4919 without 3rd party plug-ins on Ubuntu 22.04.2 LTS running via WSL2.
I want to have italic syntax highlighting for words encapsulated in underscores in comments of my cpp files.
Following is the content of my .vimrc that does that:
"italic syntax highlighting autocmd FileType cpp,hpp syntax match Italic "\v<_[a-zA-Z0-9_]*_>" containedin=cComment,cCommentL contained autocmd FileType cpp,hpp syntax match ConcealUnderscore /_/ containedin=Italic contained conceal highlight Italic cterm=italic gui=italic ctermfg=lightcyan guifg=lightcyan setlocal conceallevel=2 setlocal concealcursor=nc This works fine as long as I open my cpp/hpp files from terminal.
But as soon as I open a directory with vim and use netrw (v171) to open a source file, the underscores don't get concealed.
Opened from terminal:

Opened from netrw:

What changes do I need to do to my .vimrc/cpp.vim to conceal underscores when opening files from netrw?
I already tried:
- Creating a
~/.vim/syntax/cpp.vimand doing the highlighting there (I will use this file instead of.vimrcif possible) autocmd BufReadPost * syntax match ConcealUnderscore /_/ containedin=Italic contained concealautocmd BufEnter * if &ft == 'cpp' || &ft == 'hpp' | syntax match ConcealUnderscore /_/ containedin=Italic contained conceal | endifautocmd BufReadPost * :syntax sync fromstart
I expected: underscores to be concealed when opening files from netrw
netrwwhat is the value ofconceallevel? What is the result of the following command::set conceallevel?std::vectorexpands in size as needed, I don't think it ever releases memory unless you make it do so.