ciaranm / securemodelines

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

foldmarker=<section,</section does not work #12

Open denilsonsa opened 11 years ago

denilsonsa commented 11 years ago

Due to this regex: https://github.com/ciaranm/securemodelines/blob/master/plugin/securemodelines.vim#L62

My foldmarker (which is great for HTML) is not being set, and no warning is being printed.

<!-- vim:set foldmethod=marker foldmarker=<section,</section -->

There are two issues:

  1. There should have been a warning in that case. It would have saved me a lot of debugging time.
  2. That setting should work. Maybe we should have some special-case for options that allow a freeform string (such as foldmarker, and maybe the issue 9).
ciaranm commented 11 years ago

The regex is deliberately strict, since it's better to reject legitimate but strange data than it is to accept characters that Vim might then interpret as 'special' and do something broken. If you're doing something funky, you can either use your vimrc instead of modelines, or just take the risk and enable Vim's "anything goes" modelines.

A warning might be a possibility, but we'd have to be careful not to allow malicious files to spam the user.