sc wrote:
> On Wednesday 17 December 2008 10:34 am, sc wrote:
>   
>> charles--
>>
>> again i find myself struggling to maintain my own
>> formatoptions settings through uses of netrw
>>
>> netrw version:  v134
>>
>> formatoptions before using netrw:  tcq
>> formatoptions after using netrw:  nroql2
>>
>> method of netrw invocation:
>>
>> nmap <F11> :call MyExplore()<CR>
>>
>> function! MyExplore()
>>     let save_locate = @/
>>     let @/ = '^' . escape(expand("%:t"), ' .\')
>>     let g:netrw_sort_by = "name"
>>     let g:netrw_sort_direction = "normal"
>>     Explore %:p:h
>>     normal gg
>>     silent normal n
>>     normal zz
>>     let @/ = save_locate
>> endfunction
>>
>> this time i was using vim (not gvim) version 7.2.69 on suse
>> linux 10.2
>>
>> have you re-introduced old bugs, or have i found a new way
>> to trick it?  or....
>>
>> sc
>>     
>
> i'd like to add a usage note so you can reproduce this:  i
> used 'vime' to start my session, which is a simple script
> that starts vim in netrw:
>
> #!/bin/bash
> vim -c "Explore ."
>
> buffers i opened from that netrw had my original
> formatoptions settings, even as i went back to netrw adding
> more buffers, but after i quit a buffer using
>
> nmap <silent> <F3> :silent bdelete<CR>
>
> the buffer i landed in showed, by virtue of
>
> nmap <S-F4> :verbose set fo?<CR>
>
> (a mapping i was cautious enough not to get rid of) 
>
>   formatoptions=nroql2
>         Last set from /usr/local/share/vim/vim72/autoload/netrw.vim
>
> i can't imagine how or why netrw is tampering with my
> formatoptions when i am 'bdelete'ing a buffer, but it
> appears that's what's happening
>
> sc
>
>
>   formatoptions=nroql2
>       Last set from /usr/local/share/vim/vim72/autoload/netrw.vim
>
>   formatoptions=nroql2
>       Last set from /usr/local/share/vim/vim72/autoload/netrw.vim
>   
Hello!

I'm sorry you're having problems -- unfortunately, so far I've been 
unable to duplicate your problems.  I'm using netrw v135g; I suggest 
that you try using that version first:

  http://mysite.verizon.net/astronaut/vim/index.html#NETRW

Now, as to why "netrw is tampering with your formatoptions"; netrw saves 
your options, does it display work, and then restores your options.  
Consequently, you can always expect that netrw will have "tampered with 
your formatoptions" as shown by the "Last set..." message after having 
used netrw; what netrw is not supposed to do is to leave your options 
unrestored.

I used the following script to test your problem:
-----sc.vim--------------
nmap <F11> :call MyExplore()<CR>

function! MyExplore()
    let save_locate = @/
    let @/ = '^' . escape(expand("%:t"), ' .\')
    let g:netrw_sort_by = "name"
    let g:netrw_sort_direction = "normal"
    Explore %:p:h
    normal gg
    silent normal n
    normal zz
    let @/ = save_locate
endfunction

set fo=tco
-------------------------

I used

  vim tmp
  :so sc.vim
  (pressed <F11>)

What I got:
Error detected while processing function MyExplore:
line    7:
E486: Pattern not found: ^tmp

Pressing the <cr> and typing   :echo &fo  showed "tco".


When I tried the following bash script: (slightly modified from yours to 
get the fo=tco in there)

#! /bin/bash
vim -c "set fo=tco" -c "Explore ."

:echo &fo

shows "tco".  Selecting the "tmp" file and pressing the <cr> atop it:

:echo &fo

also showed "tco" .  A  "bd" returned me to the bash script file, and

:echo &fo

also showed "tco".

Regards,
Chip Campbell


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

Raspunde prin e-mail lui