2

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?

  • 2
    I think you mean 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 – Christian Brabandt Feb 13 '17 at 12:29
  • @ChristianBrabandt Thanks for the help; edited my question per your corrections. If you post this below I think it would be an appropriate "accepted answer". – Luke Davis Feb 27 '17 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.