I am using the following Vim autocommand in my
augroup MyAuGroup autocmd MyAuGroup FileChangedShell * call FileChanedEvent_BuffUpdate() augroup END function FileChanedEvent_BuffUpdate() let MyBn = bufname("%") let MyStr = "Warning: File \"".MyBn."\" has changed since editing started\nSee \":help W11\" for more info." let MyTest = confirm(MyStr, "&OK\n&Load File", 2, "W") if MyTest == 2 edit else endif endfunction
with the intention to replace the default gVim behaviour when a file is changed externally (see this question). However, if multiple windows are opened, showing multiple buffers, the
edit command works on the last active window, and not on the window containing the buffer that was changed.
How can I determine which buffer caused the
FileChangedShell event, and apply the
edit commant to that buffer?