Related to this thread, How can Vim tell me which buffer is changed on disk among multiple buffers?
This Vim configuration automatically checks for changes in opened buffers and notifies when a single file has been modified externally.
set autoread
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI *
\ if mode() !~ '\v(c|r.?|!|t)' && getcmdwintype() == '' | checktime | endif
autocmd FileChangedShellPost *
\ echohl WarningMsg | echo "File " . expand('<afile>') . " changed on disk. Buffer reloaded." | echohl None
Desired Feature
When multiple files are changed externally, for example, with the tabs open for files A.cpp, B.cpp, C.cpp, and D.cpp.
If two files (A.cpp and C.cpp) are modified outside Vim, the notification should show: "File A.cpp C.cpp changed on disk. Buffer reloaded."
FileChangedShellPost
is triggered for each buffer so maybe instead of echoing the message directly you could add the filename to a global variable and then have a function which would be called periodically with a trigger. The function would check the content of the variable, create the message and echo it and empty the global variable.