Sunday, January 5, 2014

Re: Netrw tripping over itself: tree-view, modified buffers, and disregarding the `hidden` option

Ivan wrote:
> I'm running into a two-part problem with Netrw:
>
> 1. Netrw is ignoring the `hidden` option, so even though I have `hidden` set, it won't open a buffer in the previous window if that window contains a modified buffer.
>
> 2. In "tree" view, the explorer buffer often gets marked as "modified", preventing a buffer from opening in the current window.
>
> I can illustrate with this minimal .vimrc,
>
> set nocompatible
> set encoding=utf-8
> filetype plugin indent on
> set hidden
> let g:netrw_liststyle=3
>
> and the following workflow:
>
> - Start Vim
> - Insert some text
> - Run `:Vexplore`
> - Navigate the tree to an existing file
> - Hit `P` to open it in the previous window
>
> Because it isn't respecting the `hidden` option, Netrw won't open the file in the desired window, and instead tries to open it in the current one. But the Netrw buffer occupying the current window has somehow become marked as modified, so Vim displays the following prompt: "Save modified file<NetrwTreeListing 1>?"
>
> While issue #2 is a bit of an edge case, #1 is a significant problem for me. Is Dr. Chip out there? Is anyone else having this problem?
>
> Version info:
> Vim 7.4 (2013 Aug 10, compiled Oct 23 2013), MacOS X (unix) version, Patches 1-22, Compiled by Homebrew, Huge version with MacVim GUI
>
Please try v150s of netrw, available at my website:
http://www.drchip.org/astronaut/vim/index.html#NETRW . This version
fixes, I believe, your issue#1.

I suspect your issue#2 is not due to the netrw buffer being marked as
modified, rather, its due to a misdirected report made by
s:NetrwPrevWinOpen() that said that the Netrw listing was modified when
actually it was the previous-window-buffer that was modified. That has
been fixed in 150s, too.

Regards,
Chip Campbell

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment