FocusedWolf

VIM: Extra Highlighting

Jul 18th, 2020 (edited)
920
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 1.29 KB | None | 0 0
  1. augroup highlight_sentences_that_end_with_colon
  2.     au!
  3.     " SOURCE: https://stackoverflow.com/a/30552423/490748  
  4.  
  5.     " Add highlights to commented text.
  6.     au Syntax * syn match moreTodo /\v([[:space:]]|^)@<=([[:alnum:].][^\]})])@=([[:space:]]=[^[:space:]]+)+(:)@<=([[:space:]]|$)@=/ contained containedin=.*Comment.*
  7.  
  8.     " Add highlights to non-commented text.
  9.     au Syntax text,vimwiki syn match moreTodo /\v([[:space:]]|^)@<=([[:alnum:].][^\]})])@=([[:space:]]=[^[:space:]]+)+(:)@<=([[:space:]]|$)@=/
  10.  
  11.     hi def link moreTodo Todo
  12.     " hi def link moreTodo Title
  13.     " hi def link moreTodo Question
  14.     " hi def link moreTodo Statement
  15. augroup END
  16.  
  17. " There are subtle differences between these two statements.
  18. "
  19. " The first statement highlights matches in commented text. The beginning of the
  20. " statement, "au Syntax *", allows it to highlight in all filetypes. However the
  21. " ending of the statement, "contained containedin=.*Comment.*", constrains it to
  22. " filetypes with highlight groups named "Comment", or contains the word "Comment",
  23. " i.e. program-language filetypes that Vim knows how to highlight.
  24. "
  25. " The second statement highlights matches in non-commented text. The beginning of
  26. " the statement, "au Syntax text,vimwiki", constrains it to text and vimwiki files.
Add Comment
Please, Sign In to add comment