Turning off W11 without autoread?

1 view
Skip to first unread message

Ted Pavlic

unread,
Nov 20, 2008, 12:28:53 PM11/20/08
to vim_use
Vimmers --

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>

Ben Schmidt

unread,
Nov 20, 2008, 2:17:23 PM11/20/08
to vim...@googlegroups.com

Ted Pavlic

unread,
Nov 20, 2008, 2:32:59 PM11/20/08
to vim_use
>> Is there any way to turn off warning W11 without turning on autoread?

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 --

Reply all
Reply to author
Forward
0 new messages