Simple question -- what is the difference between the two? When I try, for example, to highlight characters on every line after the 80th with highlight link OverLength Error
(OverLength being an arbitrary syntax name), using
match OverLength /\%80v.\+/
highlights the characters as desired, but
syntax match OverLength /\%80v.\+/
does not. What's going on here? Is use of the syntax sub-commands restricted to files in the .vim/syntax
folder? What would even be the rationale for that?
match OverLength /\%80v.\+/
and:hi OverLength Error
And the difference is that:syn
commands are used for actually defining the syntax of a buffer (and they basically can build a language) by matching against different parts of a buffer, while:match and getmatch()
function allows for easier more "throw away like" highlighting that can easily added and changed without having to need to build up a complete syntax language. syntax highlighting can get really complex really fast, because of the priorities in which parts are defined