You could set up an autocommand that reads the first few lines of the file and sets any option you like from there. Maybe you'd need to put it on a one second timer or something.
The security problem comes because you might have makeprg set to something for your project and then you open a new file that sets it to, say, 'rm -rf /' or some such. You try to build your project innocently and end up deleting your system. Salman On Thu, Apr 17, 2025, 20:31 dvalin via vim_use <vim_use@googlegroups.com> wrote: > When Vimming a number of wildly disparate textfiles, each with a single > custom processing requirement, it would be absolutely ideal to set makeprg > (or equivalent) in a modeline. But for makeprg that is verboten: "This > option cannot be set from a |modeline| or in the |sandbox|, for security > reasons." > > Mind you, here there is no such security concern - whether any command is > run by ":!" or makeprg makes no real difference, so I'm not entirely sure > why one would impose the clumsiness of having to insert ":!groff -k -Tpdf > -ms -m hdtbl -dpaper=a4 -P-pa4 % > /tmp/vde.pdf" or whatever another file > needs? > > So is there a file-local way to just alias e.g. ^m to a shell command, > **in the modeline**? That would be much faster to invoke, and not muck with > makeprg. > > Vim can do everything; it's finding the clue in the :help that is the > challenge, even going in with a packed lunch. > > Erik > > > > -- > -- > 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+unsubscr...@googlegroups.com. > To view this discussion visit > https://groups.google.com/d/msgid/vim_use/d896d28d-744e-4f17-a397-6032c2e0db34%40localhost > <https://groups.google.com/d/msgid/vim_use/d896d28d-744e-4f17-a397-6032c2e0db34%40localhost?utm_medium=email&utm_source=footer> > . > -- -- 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+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_use/CANuxnEeJrrioUqmeMPPLhv%2Bhfb9me-kTapDwDj1QOrdnWuNCsw%40mail.gmail.com.