I've been using FileChangedRO
for a while now to automatically checkout files when starting to edit them and found the W12 warning annoying as well. The problem is that p4 edit updates the file attributes to remove the read only flag. If as part of the initial edit you also change the file, Vim sees this as a conflict since it's no longer read only. Here's the solution I use which is a bit more conservative about using FileChangedShell
in case the file was changed externally for some other reason.
let s:IgnoreChange=0
autocmd! FileChangedRO * nested
\ let s:IgnoreChange=1 |
\ call system("p4 edit " . expand("%")) |
\ set noreadonly
autocmd! FileChangedShell *
\ if 1 == s:IgnoreChange |
\ let v:fcs_choice="" |
\ let s:IgnoreChange=0 |
\ else |
\ let v:fcs_choice="ask" |
\ endif