I am trying to add bold comments to my vim files. What i mean, is to be able to get something like this:
I saw other articles like this that allow to toggle bold comment.
The proposed solutions from those articles act as follows: when i toggle the function, ALL comments we be bold, or ALL comments we be normal. So that looks like:
However, i am trying to only make certain parts of comment bold, like in the first image.
How to i do this?
Edit: Thanks to the help of @klaus, a possible solution is to do:
sy match myBoldComment '-\+\s\+[^-]*\s\+-\+' | hi myBoldComment cterm=bold gui=bold
Obviously, the pattern is up to you :)
$VIMRUNTIME/syntax/vim.vim
and:g/vimCommentTitle
:h :hilight
. It will explain how the code is highlighted in vim. Then check the file Ben mentioned,vim.vim
. There is a highlight-group calledvimCommentTitle
, which is made into a reference of another highlight group calledPreProc
. So, if you want your vim comments to have their titles in bold, you have to do:hi Preproc cterm=bold, gui=bold
. Report back if it works or not. Mind you, it's only gonna work with comments in filetype vim (I think).syn match vimCommentTitle
) and see where in the regexp is a colon. Try adding a zero-or-many space before that colon (turn:
into\s*:
) and see if it works. You might needsudoedit
if the file is readonly.-\+\s\+[^-]*\s\+-\+
. If you know regexp in other languages, I think you can decode that pattern. Try playing with it until it fits your exact need. But I would try and understand vim's default syntax pattern for commentTitle and add to it instead of totally redefining it.