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.
(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
.
Notification settings. Under “Edits,” choose when you want to receive notifications: Added or removed content: You'll be notified whenever anyone adds or removes content in that file. None: Never receive emails about edits for that file.
Turn notifications on or off for all filesRight-click the OneDrive icon (looks like a white cloud) on the system tray of your task bar and select Settings. On the Settings tab, you'll find a check box to enable or disable notifications.
You can get an alert whenever a file, link, or folder is changed in a SharePoint document library. Depending on the item (file, folder, link), you may see different options when you set an alert.
If autoread
is 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 :checktime
periodically using the recipe at http://vim.wikia.com/wiki/Timer_to_execute_commands_periodically:
autocmd CursorHold * call Timer()
function! Timer()
call feedkeys("f\e")
checktime
endfunction
set updatetime=5000 " milliseconds
To just print a warning, set the autocmd FileChangedShell
(Detect file change, offer to reload file):
autocmd FileChangedShell * echo "File changed, press F9 to reload."
For Insert mode, use CursorHoldI
(not sure about this feedkeys sequence, but it seems to work):
autocmd CursorHoldI * call TimerI()
function! TimerI()
call feedkeys("\<C-R>\e")
checktime
endfunction
You might have to change the FileChangedShell
autocmd from echo
to echoe
, as I don't think echo
gets printed in Insert mode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With