Saturday, June 1, 2013

Use a flag in modeline

Hi all,

I'm using some autocmd on some filetypes in order to automatically a
"compilation" step.

By example I do it for sass files that are compiled to css, markdown
converted to html, ...

au BufWritePost,FileWritePost *.md,*.mkd :!markdown "<afile>" > "%:p:r.html"
au BufWritePost,FileWritePost *.sass :!sass --compass --style expanded
<afile> > "%:p:r.css"

(I'm not fan of compilers watching the folder for changes doing it on the fly)

But now I would like to opt-in for those feature. Meaning that I'd
like to specify in the file if it should be compiled or not. So
naturally I'm searching for a way to specify this in the modeline so I
can conditionally compile in the autocmd.

Eg:

# vim: let g:compile=1:

Vim does not allow this for security reason, I saw there was a plugin
for that ( let-modeline ) but I'd like to avoid using a plugin for
such a trivial task.

So I was wondering if there was some custom or obscure boolean option
that I could use for this "compile" flag or if anyone here have a
better idea ?

Thanks.

--
Fabien Meghazi

Website: http://www.amigrave.com
Email: agr@amigrave.com
IM: amigrave@gmail.com

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment