Re: Netrw and cindent
Benji Fisher wrote: A quick look at netrw.vba.gz (searching for swf) suggests that this may be the problem: fun! netrw#NetBrowseX(fname,remote) [snip] if a:remote == 1 set bh=delete bt=nofile noswf exe norm! \c-o redraw! endif call Dret(NetBrowseX) endfun All the other matches for swf involve either :setlocal or :let l: . I did not see anything suspicious with cin. Thanks, Benji F! I've uploaded a netrw v103i with the latest fixes to my website: http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs , see Network Oriented Reading, Writing, and Browsing. Regards, Chip Campbell
Re: Netrw and cindent
Chip, Thanks for your response. I downloaded v103f and tried it. It didn't seem to help. After much experimenting I found that if I enabled filetype indent in my .vimrc, the problem with cindent goes away, as :verbose setl cindent? now reports last set by the Java indent file. I don't understand why, but it works. But I still see an issue with the swapfile option being turned off by netrw. To test, I unset my HOME environment variable to eliminate my .vimrc and all my installed plugins. Then when I repeat the 2 scenarios from my original post, noswapfile is set and :verbose setl swf? reports noswapfile last set by netrw.vim. BTW, I'm running GVim on XP. -Mark Charles E Campbell Jr wrote: Mark S. Williams wrote: I think I've uncovered an odd bug involving Netrw and the cindent local buffer option for Java files, where cindent is unset under certain conditions. I'm afraid that I don't see this problem; I tried both your examples. Please try v103f from my website: http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs , see Network Oriented Reading, Writing, and Browsing. If this problem continues to occur, then its likely some setting or other plugin is interfering (the latter most likely via an autocmd). Regards, Chip Campbell
Re: Netrw and cindent
Mark S. Williams wrote: I think I've uncovered an odd bug involving Netrw and the cindent local buffer option for Java files, where cindent is unset under certain conditions. I'm afraid that I don't see this problem; I tried both your examples. Please try v103f from my website: http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs , see Network Oriented Reading, Writing, and Browsing. If this problem continues to occur, then its likely some setting or other plugin is interfering (the latter most likely via an autocmd). Regards, Chip Campbell
Re: Netrw and cindent
Thanks Tony. It turns out that netrw is the culprit, and that the issue does not only apply to the cindent option. Netrw attempts to save, change and restore the following local buffer options: autoindent cindent cinoptions comments copyindent formatoptions swapfile textwidth But I am finding that under some conditions (see my original post) these values are not restored, and instead are retaining the values that were set by netrw. To reliably preserve these options when using file type plugins and netrw, I am now taking a more defensive approach, placing the local buffer settings before checking to see if the plugin has been executed, like this: set cindent sw=4 ts=4 swapfile if exists(b:did_java_vim) finish endif let b:did_java_vim = 1 other plugin commands follow... Note that netrw turns off the swapfile option, so to preserve the possibility of file recovery it must be explicitly turned on in the file type plugins. -Mark A.J.Mechelynck wrote: Mark S. Williams wrote: I think I've uncovered an odd bug involving Netrw and the cindent local buffer option for Java files, where cindent is unset under certain conditions. To track down the bug I removed all my Java file type plugins and created a new Java file type plugin called java.vim which contains only the following: if exists(b:did_java_vim) finish endif let b:did_java_vim = 1 setlocal cindent There are two scenarios that can reproduce the bug: Scenario #1 --- 1. Start vim in a dir with Foo.java 2. :E and select Foo.java 3. :setl cindent is set. 4. :E and select Foo.java again. 5. :setl and cindent is not set. Scenario #2 --- 1. Start vim in a dir with Foo.java and Bar.java 2. :E and select Foo.java 3. :setl cindent is set. 4. :E and select Bar.java 5. :setl cindent is set. 6. :2b to return to Foo.java 7. :setl and cindent is not set. It seems the the bug involves Netrw, I can't reproduce it when I open files with :e. Quite a puzzler. Can anyone else reproduce this one? Thanks in advance, -Mark To check which script last set the option, use :verbose setl cindent? (without quotes, but with the question mark). If it does mention netrw, check near the top of the netrw script which version of netrw you're running. You may be able to obtain a newer version from vim-online or from Dr. Chip's site. Best regards, Tony.
Netrw and cindent
I think I've uncovered an odd bug involving Netrw and the cindent local buffer option for Java files, where cindent is unset under certain conditions. To track down the bug I removed all my Java file type plugins and created a new Java file type plugin called java.vim which contains only the following: if exists(b:did_java_vim) finish endif let b:did_java_vim = 1 setlocal cindent There are two scenarios that can reproduce the bug: Scenario #1 --- 1. Start vim in a dir with Foo.java 2. :E and select Foo.java 3. :setl cindent is set. 4. :E and select Foo.java again. 5. :setl and cindent is not set. Scenario #2 --- 1. Start vim in a dir with Foo.java and Bar.java 2. :E and select Foo.java 3. :setl cindent is set. 4. :E and select Bar.java 5. :setl cindent is set. 6. :2b to return to Foo.java 7. :setl and cindent is not set. It seems the the bug involves Netrw, I can't reproduce it when I open files with :e. Quite a puzzler. Can anyone else reproduce this one? Thanks in advance, -Mark
Re: Netrw and cindent
Mark S. Williams wrote: I think I've uncovered an odd bug involving Netrw and the cindent local buffer option for Java files, where cindent is unset under certain conditions. To track down the bug I removed all my Java file type plugins and created a new Java file type plugin called java.vim which contains only the following: if exists(b:did_java_vim) finish endif let b:did_java_vim = 1 setlocal cindent There are two scenarios that can reproduce the bug: Scenario #1 --- 1. Start vim in a dir with Foo.java 2. :E and select Foo.java 3. :setl cindent is set. 4. :E and select Foo.java again. 5. :setl and cindent is not set. Scenario #2 --- 1. Start vim in a dir with Foo.java and Bar.java 2. :E and select Foo.java 3. :setl cindent is set. 4. :E and select Bar.java 5. :setl cindent is set. 6. :2b to return to Foo.java 7. :setl and cindent is not set. It seems the the bug involves Netrw, I can't reproduce it when I open files with :e. Quite a puzzler. Can anyone else reproduce this one? Thanks in advance, -Mark To check which script last set the option, use :verbose setl cindent? (without quotes, but with the question mark). If it does mention netrw, check near the top of the netrw script which version of netrw you're running. You may be able to obtain a newer version from vim-online or from Dr. Chip's site. Best regards, Tony.