I am using VIM as a note taking application and have created syntax highlighting to assist with readability.
See below or the repo for all the files.
syntax match Timestamp /^\d\d:\d\d \d\d[/]\d\d[/]\d\d\d\d -/
syntax match Complete /^\/.*$/
syntax match noteSingleDash /^\s*- .*$/ contains=KKS1,noteParenthesis2,noteCurlyBrace2,noteUpUpUp2,noteAt2
syntax match noteDoubleDash /\-- .*$/ contains=KKS1,noteParenthesis2,noteCurlyBrace2,noteUpUpUp2,noteAt2
syntax match noteTripleDash /\--- .*$/ contains=KKS2,noteParenthesis2,noteCurlyBrace2,noteUpUpUp2,noteAt2
syntax match noteQuadruDash /\---- .*$/ contains=KKS1,noteParenthesis2,noteCurlyBrace2noteUpUpUp2,noteAt3
syntax match noteParenthesis /[(].*[)]/
syntax match noteParenthesis2 /[(].*[)]/ contained
syntax match noteCurlyBrace /[{].*[}]/
syntax match noteCurlyBrace2 /[{].*[}]/ contained
syntax match noteUpUpUp /\^/
syntax match noteUpUpUp2 /\^/ contained
syntax match KKS /\a\a\a\d\d\a\a\d\d\d\S*\|\s\n/
syntax match KKS1 /\a\a\a\d\d\a\a\d\d\d\S*\|\s\n/ contained
syntax match KKS2 /\a\a\a\d\d\a\a\d\d\d\S*\|\s\n/ contained
syntax match noteAt /@\w*/
syntax match noteAt2 /@\w*/ contained
syntax match noteAt3 /@\w*/ contained
Is there a better way to apply the highlighting of parentheses, braces, carets, the KKS and "@" regexes without creating multiple lines for each?
For example can noteParenthesis be "contained" (and apply to dashed lines) while also effecting regular unhighlighted lines (text following a "Timestamp"?
My .vimrc below:
syntax on
set number
highlight LineNr ctermfg=red
:set wrap linebreak nolist
map <F5> :.! date "+\%H:\%M \%d/\%m/\%Y"<cr>
cmap w!! w !sudo tee > /dev/null %
highlight noteSingleDash ctermfg=cyan guifg=#00ffff
highlight noteDoubleDash ctermfg=magenta guifg=#d700ff
highlight noteTripleDash ctermfg=yellow guifg=#878700
highlight noteQuadruDash ctermfg=red guifg=#af0000
highlight Timestamp ctermfg=green guifg=#005f00
highlight Complete ctermfg=green guifg=#005f00
highlight noteParenthesis ctermfg=red guifg=#af0000
highlight noteParenthesis2 ctermfg=red guifg=#af0000
highlight noteCurlyBrace ctermfg=red guifg=#af0000
highlight noteCurlyBrace2 ctermfg=red guifg=#af0000
highlight noteUpUpUp ctermfg=cyan guifg=#00ffff
highlight noteUpUpUp2 ctermfg=cyan guifg=#00ffff
highlight KKS ctermfg=yellow guifg=#878700
highlight KKS2 ctermfg=magenta guifg=#d700ff
highlight KKS1 ctermfg=yellow guifg=#878700
highlight noteAt ctermfg=red guifg=#af0000
highlight noteAt2 ctermfg=red guifg=#af0000
highlight noteAt3 ctermfg=cyan guifg=#00ffff