This is potentially just a misunderstanding on my part, but it looks
like a bug at the moment so I'm posting it here.

I have a few lines in my .vimrc that I've narrowed the problem down
to. Here is the minimal .vimrc I used to test. Note how I remove my
normal customizations from my runtime path.

====begin test .vimrc====

set nocompatible
set runtimepath-=$HOME/vimfiles
set runtimepath-=$HOME/vimfiles/after

let g:c_syntax_for_h = 1

filetype indent plugin on
syntax on

autocmd Syntax c if !&diff | setlocal foldmethod=syntax | endif | call
EchoEnv('foldmethod')
autocmd Syntax c if !&diff | exec 'normal zR' | endif | call EchoEnv
('openfolds')
autocmd BufWinEnter * if !&diff | exec 'normal zv' | endif | call
EchoEnv('bufwinenter')

function EchoEnv(event)
  echomsg a:event.': fdm='.&fdm.' diff='.&diff.' ft='.&ft.' fdl='.&fdl
endfu

====end test .vimrc====

When I call gvimdiff on two similar .c files, the diff opens fine, but
the first fold in the second file only is open. Without the
BufWinEnter command, this does not happen. In other words, the "exec
'normal zv'" command is firing on the second file (and only the second
file). The EchoEnv function which I added for debug confirms this:

"~\My Local Data\Peer_review_files
\SatelliteManager.c@@.main.FSA-6000.V2.0_Development.10.c" 1226L,
46305C
foldmethod: fdm=diff diff=1 ft=c fdl=0
openfolds: fdm=diff diff=1 ft=c fdl=0
bufwinenter: fdm=diff diff=1 ft=c fdl=0
"~\My Local Data\Peer_review_files
\SatelliteManager.c@@.main.FSA-6000.V2.0_Development.11.c" 1227L,
46411C
foldmethod: fdm=syntax diff=0 ft=c fdl=0
openfolds: fdm=syntax diff=0 ft=c fdl=5
bufwinenter: fdm=syntax diff=0 ft=c fdl=5

It looks like somehow, for the second file, 'diff' does not get set
until *after* the BufWinEnter autocmd event.

:help diff indicates that you can override options set by a diff using
a modeline. This indicates that modelines are processed after diff
mode is set. :help BufWinEnter states that it fires after modelines,
so logically it must be after diff mode gets set as well.

However, as you can see from the debug output above, this is not the
case.

What's going on?

I'm using:

VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Jan 20 2010 14:03:25)
MS-Windows 32-bit GUI version with OLE support
Included patches: 1-343
Compiled by [email protected]
Huge version with GUI.

-- 
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui