6

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
  • 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 Commented Feb 13, 2017 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
    Commented Feb 27, 2017 at 18:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.