0

I really dislike vim taking the focus when I enter a window with a file that has been edited elsewhere, asking me to pick (O)k, (L)oad file and other options.

There is a solution for that: register a callback to the FileChangedShell autocommand to override the behavior. I'm doing that, and it works great.

However this doesn't cover a "corner case":

  1. create the file in vim, edit it, do not save it (so the file doesn't exist on disk)
  2. create the file outside of vim (eg echo test > fname)
  3. go back in vim
  4. trigger :checktime
  5. instead of triggering the FileChangedShell autocommand as I expected, vim bypasses it, and displays a blocking message Warning: File "x" has been created after editing started [O]K, [L]oad File, (a)nd options:

Is there a way to override this behavior in the same way that I can override the other related behaviors using FileChangedShell?

1 Answer 1

0

Yeah, as far as I can tell in the vim+neovim source, this would require a patch to add a new feature, it's a separate codepath with no autocommands it would seem:

In both cases this is the next else if condition after the case which triggers the autocommands, and that branch does no such thing. So it seems I'm out of luck for now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.