Before I heard about vim, I used to use gedit. I still try to make vim behave as same as gedit, this is because I have asked many questions related to vim on StackOverflow.
One feature I am missing is when any file was modified while I was working on any file on gedit by another application, a popup use to come which says The file <file_location> changed on disk. Do you want to reload the file? And there were two buttons named Reload and Cancel respectively.
What I want:
(Please note that I am using vim, not gvim) I want similar feature in vim. I want if any file get changed on disk, a warning message come at status bar:
File changed, press F9 to reload.
I will map my F9 to do :e.
If
autoreadis set, vim checks whether the file has been modified after each shell command (:!), on writing the file, and when you issue:checktime. gvim in addition checks when you switch window focus to the application.You can execute
:checktimeperiodically using the recipe at http://vim.wikia.com/wiki/Timer_to_execute_commands_periodically:To just print a warning, set the autocmd
FileChangedShell(Detect file change, offer to reload file):For Insert mode, use
CursorHoldI(not sure about this feedkeys sequence, but it seems to work):You might have to change the
FileChangedShellautocmd fromechotoechoe, as I don’t thinkechogets printed in Insert mode.