Thursday, June 21, 2012

Re: Mode line in template not run, but is run when reloading file.

On 22/06/12 00:43, hardkrash wrote:
> When using qtmplsel.vim the mode lines in my templates are not processed.
>
> So when I have expand tabs set and other options in model lines they are not being followed.
>
> How can I programmatically evaluate the text to yes the freshly inserted modeline.
>
> Currently I need to write the file and reread the file to process the modeline.
>
> Steve
>

Yes, I think that's the way to go: From the help:

> 3. If you start editing a new file, and the 'modeline' option is on, a
> number of lines at the beginning and end of the file are checked for
> modelines. This is explained here.
>
> *modeline* *vim:* *vi:* *ex:* *E520*

IOW, if you modify a file to add a modeline, the modeline won't take
effect until you reread the file to "start editing" it.

If 'autowriteall' is set, just :e will do the trick; otherwise you need
to precede it with :w or :up

However, if the modeline is written by an autocommand, there might be
tricks about it: a command issued by an autocommand will sometimes
trigger further autocommands, and sometimes it won't. The process is
deterministic but I don't understand it fully.


Best regards,
Tony.
--
... And then there's the guy who bought 20,000 bras, cut them in half,
and sold 40,000 yamalchas with chin straps ...

--
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

No comments: