Hari Krishna Dara wrote:
[...]
In the vimrc_example.vim, there is a common on this and part of it says:

  " Don't do it when the position is invalid or when inside an event handler
  " (happens when dropping a file on gvim).

Any idea what it is exactly talking about? Is the "Don't do it" part
a comment on how the functionality of the autocommand or an instruction
to the user?


The words "Don't do it" are not an order to the user, but a comment on what Vim does:

If, for instance, the "remembered" line number is less than one or greater than the number of lines in the now-existing file, no repositioning will be done. This is what "the position is invalid" means. This can happen if the file has been modified or overwritten between closing and reopening Vim, or even between unloading and reloading the file.

"Inside an event handler" means that the autocommand is not defined as "nested", which means that the autocommand will not be triggered from within an autocommand for a different event (as when, IIUC, a file is drag-dropped onto an existing gvim window). I don't use drag-drop for Vim so this doesn't bother me. If you often encounter the problem, you might try adding the "nested" keyword to the autocommand (see ":help autocmd-nested") but there might be side-effects. I suppose Bram didn't lightly choose to add a comment rather than a keyword.


Best regards,
Tony.

Reply via email to