ciaranm / securemodelines

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

doesn't work when vim is reading from stdin [PATCH] #1

Closed huancz closed 13 years ago

huancz commented 13 years ago

I frequently use commands similar to this (reduced example): "(echo 'vim: syntax=XXX'; cat somefile) | vim -R -"

This works with native modelines, does not with secure modelines.

After this fix, it works as expected: --- securemodelines.vim.orig 2011-01-14 22:42:27.000000000 +0100 +++ securemodelines.vim 2011-01-14 22:42:09.000000000 +0100 @@ -145,6 +145,6 @@

 aug SecureModeLines
     au!
-    au BufRead * :call <SID>DoModelines()
+    au BufRead,StdinReadPost * :call <SID>DoModelines()
 aug END
ciaranm commented 13 years ago

Thanks. Could you provide this as a git format-patch or a pull request please, so I can give proper credit?

ciaranm commented 13 years ago

Thanks again.