On Tue, Jul 11, 2006 at 06:53:23PM -0500, scott wrote:
> charles--
> 
> i have formatoptions set in my .vimrc to tcroqn
> 
> i have a script i call gvime that starts 'vim -g -c Explore'
> (i tried 'gvim -c Explore' with the same result)
> 
> if i run gvime, and select a file to edit, i find
> formatoptions is now croqn -- the t has been whacked,
> and even with a modeline setting textwidth, i am
> manually formatting paragraphs, running scriptnames,
> and generally having a bad day

     I think I see the problem.  In $VIMRUNTIME/autoload/netrw.vim , in
the function netrw#DirBrowse() , there are the lines

  if &fo =~ '[ta]'
   set fo-=t
   set fo-=a
   echohl Warning
   echo '***warning*** directory browsing and formatoptions "ta" are 
incompatible'
   echohl None
  endif

(I am not sure that I ever get to see that warning message.)  I think
that replacing :set with :setlocal will fix the problem.  Remember, when
dealing with a local option, :set changes both the local value and the
global default; :setlocal changes only the value.

     I think other options are being affected, too.  I am too
bleary-eyed to be sure, but I think that 'spell' and 'tw' in other
buffers are being affected by the netrw window.  I think the problem
comes from lines like

  if exists("w:spellkeep")|let &spell  = w:spellkeep   |unlet w:spellkeep|endif
  if exists("w:twkeep")   |let &tw     = w:twkeep      |unlet w:twkeep   |endif

Instead of

        :let &spell = ...

I think it should be

        :let &l:spell = ...

:help local-options
:help expr-option

HTH                                     --Benji Fisher

Reply via email to