Is there any way to turn off warning W11 without turning on autoread?
In my case, I *don't* want a dialog box to pop up every time the file
gets changed on the disk, but I also don't want the Vim buffer to
automatically get updated.
It seems like I could set "buftype" to something nonempty, but that
doesn't seem like a good idea.
Thoughts?
Thanks --
Ted
--
Ted Pavlic <t...@tedpavlic.com>
Something similar to
http://vim.wikia.com/wiki/File_no_longer_available_-_mark_buffer_modified
should work.
Ben.
Thanks, Ben! That's very helpful.
For now, I'm going to try:
au FileChangedShell * call FCSHandler(expand("<afile>:p"))
function FCSHandler(name)
let msg = 'File "'.a:name.'"'
let v:fcs_choice = ''
if v:fcs_reason == "deleted"
let msg .= " no longer available - 'modified' set"
call setbufvar(expand(a:name), '&modified', '1')
echohl WarningMsg
elseif v:fcs_reason == "time"
let msg .= " timestamp changed"
elseif v:fcs_reason == "mode"
let msg .= " permissions changed"
elseif v:fcs_reason == "changed"
"let msg .= " contents changed"
"let v:fcs_choice = "ask"
let msg .= " contents changed - 'modified' set"
call setbufvar(expand(a:name), '&modified', '1')
echohl WarningMsg
elseif v:fcs_reason == "conflict"
"let msg .= " CONFLICT --"
"let msg .= " is modified, but"
"let msg .= " was changed outside Vim"
"let v:fcs_choice = "ask"
"echohl ErrorMsg
let msg .= " CONFLICT --"
let msg .= " is modified, but"
let msg .= " was changed outside Vim"
call setbufvar(expand(a:name), '&modified', '1')
echohl WarningMsg
else " unknown values (future Vim versions?)
let msg .= " FileChangedShell reason="
let msg .= v:fcs_reason
let v:fcs_choice = "ask"
echohl ErrorMsg
endif
redraw!
echomsg msg
echohl None
endfunction
I may decide that I want "conflict" handled in the old way. I may decide
that I don't want modified to get set when the file changes. I haven't
decided, but this at least gets rid of the ugly W11 (that at least makes
me want to take my hands of the keyboard :( ).
Thanks, again --