vint icon indicating copy to clipboard operation
vint copied to clipboard

Feature request: warn to use <nomodeline> with User autocmds

Open lencioni opened this issue 10 years ago • 3 comments

As recommended by the :h <nomodeline> docs:

After applying the autocommands the modelines are
processed, so that their settings overrule the
settings from autocommands, like what happens when
editing a file. This is skipped when the <nomodeline>
argument is present. You probably want to use
<nomodeline> for events that are not used when loading
a buffer, such as |User|.

lencioni avatar Aug 11 '15 03:08 lencioni

Thanks, @lencioni .

I don't know what events that we should warn when the autocmd has no <nomodeline>. Would you list the events?

Kuniwak avatar Aug 11 '15 15:08 Kuniwak

Ah, I was thinking it would be nice to warn when it wasn't there for User events. Something like this:

silent doautocmd User MyUserCmd

should be:

silent doautocmd <nomodeline> User MyUserCmd

This was only added in Vim 7.3.438 so maybe that should be part of the message so that it can be made conditional?

if v:version > 703 || v:version == 703 && has('patch438')
  silent doautocmd <nomodeline> User MyUserCmd
else
  silent doautocmd User MyUserCmd
endif

lencioni avatar Aug 11 '15 16:08 lencioni

OK, I agree this policy.

I'm gonna implement it later.

Kuniwak avatar Aug 14 '15 15:08 Kuniwak