I am developing a command line application that uses Vim to edit an existing file. Think visudo or crontab -e.

Is there any command line option that I can pass to Vim to disable shell commands?

  • 1
    Could you provide some more detail about what you're trying to do, to demonstrate the problem? What is being escaped, and why don't you want it escaped?
    – JigglyNaga
    Feb 7, 2018 at 14:32
  • Just FYI, the term "shell escaping" is usually used in Vim to refer to the practice of altering string-format commands in order that they are interpreted correctly by the shell. See :help shellescape(). What I think you're talking about is usually referred to as "shell commands" or sometimes "shelling out".
    – Rich
    Feb 8, 2018 at 11:06

1 Answer 1


The -Z (restricted mode) command line option is what I'm looking for. This provides sufficient protection against :! being used. Thanks to Rich and B Layer for pointing this out in my sister question, "Prevent saving buffer with new name"

Your Answer

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

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