> [...]
>
> It means that :doautocmd triggers modeline processing in any context.
I have occasionally used :doautocmd, but that didn't cause any problems for me.
I do share your concerns, a clear separation (e.g. :domodelines) or at least
good explanation would be appreciated.
> For example, I have something like the following in my vimrc to
> indicate
> the same code will be run at both CursorHold and CursorHoldI events:
>
> augroup MyConfig
> autocmd CursorHold * call s:save_stat()
> autocmd CursorHoldI * doautocmd MyConfig CursorHold
> augroup END
You can group events, this makes it even clearer, and no need for :doautocmd:
augroup MyConfig
autocmd CursorHold,CursorHoldI * call s:save_stat()
augroup END
-- regards, ingo
Ah, I forgot about that syntax of :autocmd.
Thank you for the tip.
The original idea of this command was to execute autocommands for
loading the buffer. So that you can trigger the right autocommands if
the file type wasn't detected.
It would make sense to only trigger modelines when executing the
autocommands that are used when loading a buffer. That might be
complicated though. Alternatively we could add an argument to the
command to skip processing modelines. We could use the [!] flag,
although it might be a bit strange to have this effect.
Perhaps a <nomodeline> argument?
--
What is the difference between a professional and an amateur?
The ark was built by an amateur; professionals gave us the Titanic.
/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Thank you for the reply. I understand the original intention about
triggering modelines.
> It would make sense to only trigger modelines when executing the
> autocommands that are used when loading a buffer. That might be
> complicated though. Alternatively we could add an argument to the
> command to skip processing modelines. We could use the [!] flag,
> although it might be a bit strange to have this effect.
> Perhaps a <nomodeline> argument?
I prefer <nomodeline> to the others. It is less complicated than the
others, and it is backward compatible for existing scripts. I'll try to
make a patch.