Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to configure vim to enable 'modeline' (and by extension, setting 'modelines' to be non-zero), but restricting the parsing capability of modelines in files?

I want to enable setting of tabstops, softtabstops, and filetype in files, while keeping modelines otherwise disabled (for security cosiderations).

share|improve this question
up vote 3 down vote accepted

You can use the vim plugin securemodelines : Secure, user-configurable modeline support to whitelist allowed commands in modelines. Note that the version on is 5 years old, the latest version of the plugin on github has some minor tweaks.

share|improve this answer
Thanks. This has exactly the features I was looking for. I had to learn about using vim plugins, which led me to the amazing Pathogen, which was followed by the even more amazing Vundle). – scottbb Apr 27 '13 at 20:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.