I have a file, /tmp/file.txt that is being edited by vim (or neovim), as well as some other external process.

I wish the external app to notify vim, in such a way that vim takes that notification to reload the file.

Any kind of external hooks? To let other external apps tell vim "hey, you may want to do something now"?

The reason I ask this, is because autoread doesn't always work.

  • You can use checktime periodically from an autocmd or timer to have Vim check the external file for modifications periodically. See this answer and the one below it, for example. It's not exactly what you're looking for (notification from external source), but I believe it should solve your actual issue.
    – filbranden
    Jul 31 '19 at 14:51
  • I hadn't tested, but if you run vim as client server, you may be able to do this with --remote-expr.
    – Lie Ryan
    Aug 1 '19 at 0:19
  • It depends on the OS, but you can simulate a sequence of key presses sent to vim. Another option would be subscription to event using builtin python. I assume that it won't stuck neovim at least. Another idea, open a terminal or execute with :! a task that would exit at the right time.
    – eyal karni
    Aug 26 '19 at 23:05

Your Answer

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

Browse other questions tagged or ask your own question.