ciaranm / securemodelines

A secure alternative to Vim modelines
107 stars 29 forks source link

Do not require a white space between {vi:|vim:|ex:}: and {options} #6

Closed miorimmax closed 13 years ago

miorimmax commented 13 years ago

The Vim documentation (:help modeline) says there are two forms of modelines: [text]{white}{vi:|vim:|ex:}[white]{options}

[text]{white}{vi:|vim:|ex:}[white]se[t] {options}:[text]

In both cases the white space after {vi:|vim:|ex:}: is optional but the regular expression used to handle the latter form did require at least one white space, ignoring otherwise conforming modelines.

To address this, the regular expression has been changed to match against zero or more white spaces after {vi:|vim:|ex:}: whilst requiring at least one after the string 'set', if present.

Note that the documentation is not clear if more than one white space is allowed, this assumes it is.