Re: FileChangedRO (vim-6.0au)
- Mike Steed wrote:
> gvim -u NONE -U NONE
> :syntax on
> :autocmd FileChangedRO * edit
> :edit foo.c (a read-only file)
> i (enter insert mode)
> At this point, the autocommand is triggered, the file is re-read, and
> (the problem) syntax highlighting is lost.
> What I'm trying to do is use FileChangedRO to check a file out of
> source control, as the docs suggest. The source control system we are
> using replaces my local copy of a file when I check it out, if my copy
> is out of date. In order to get the latest version of the file, one of
> the things I am doing in the autocommand is re-reading the file (:edit).
> But this has the effect of breaking syntax highlighting.
> Maybe :edit is not expected to work in the context of an autocommand,
> just before entering insert mode. But this makes FileChangedRO less
> useful than it could be. Can this be made to work, or is there a better
> way to accomplish the same thing?
HTH --Benji Fisher