I am working with text files and Goyo. I'd like to highlight two different kinds of notes delimited by brackets (one called "NOTE:" and the other "TODO:") in different colors.
I want to highlight everything within the brackets not just the words "NOTE" or "TODO". Below is the code I have in my init.vim (I am using Neovim btw). It works fine if I try to highlight only one thing. But if I add line 220 and line 223 below (duplicating the call to highlight and the match) it doesn't highlight anything at all.
How can I highlight different matches ("Notes", "Todos" and anything else I might need later) with different colors?
0 function! s:goyo_enter()
212 Pencil
213 Limelight
219 highlight noteHi ctermfg=Magenta cterm=italic
+ 220 highlight todoHi ctermfg=Green cterm=italic
222 match noteHi /\[\cNOTE:[^\]]*\]/
+ 223 match todoHi /\[\cTODO:[^\]]*\]/
227 endfunction
I have also tried using matchadd() with a regex in quotes but the patterns don't match. If I remove everything leaving only "NOTE" and "TODO" in quote those do get highlighted, but it's not what I want.
I want to highlight everything within the brackets that start with those words. For example, [TODO: Do something here.] would have all the text inside the brackets highlighted.
226 call matchadd("noteHi", "\[\cNOTE:[^\]]*\]")
227 call matchadd("todoHi", "\[\cTODO:[^\]]*\]"