Loading ...
Sorry, an error occurred while loading the content.
 

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

Expand Messages
  • Ivan
    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
    Message 1 of 9 , Jan 4, 2014
      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

      --
      --
      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@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Bruno Sutic
      ... Hi Ivan, yea, I m on Netrw v150j, and I can reproduce the first problem. After I hit P , (and the previous buffer is modified) I get this: Save modified
      Message 2 of 9 , Jan 5, 2014
        On Sunday, January 5, 2014 6:08:25 AM UTC+1, 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

        Hi Ivan,
        yea, I'm on Netrw v150j, and I can reproduce the first problem.
        After I hit 'P', (and the previous buffer is modified) I get this:
        "Save modified file<NetrwTreeListing 1>?
        [Y]es, (N)o, (C)ancel:"

        I don't know how to reproduce the second issue you mentioned though.

        Just FYI, installing the latest version from Dr. Chip's website helps sometimes:
        http://www.drchip.org/astronaut/vim/index.html#NETRW
        It's a pitty this isn't available from github (so we can install it via pathogen/Vundle)

        I also reported an issue with netrw 'tree mode' a couple months back and Dr. Chip resolved the issue since. Here's my bug report:
        https://groups.google.com/forum/?fromgroups=#!search/%5Bbug%5D$20netrw$20with$20netrw_liststyle/vim_dev/07wTmXWz2EU/1JCCLeffavsJ

        So, if it's any consolation, Dr. Chip is still actively maintaining the plugin and fixing bugs (doing a good job I think btw.).
        On the flipside, yea, there's a lot of bugs (especially for non-standard workflows) and the repo + issue tracking is non existant.

        --
        --
        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@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Charles Campbell
        ... 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
        Message 3 of 9 , Jan 5, 2014
          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@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Ivan
          ... Cool, thank you! I m not sure how to integrate the new version into my current Vim. Maybe I should start a different thread for this, since it s not Netrw
          Message 4 of 9 , Jan 6, 2014
            On Monday, January 6, 2014 1:01:50 AM UTC-5, Charles Campbell wrote:
            > Please try v150s of netrw, available at my website

            Cool, thank you! I'm not sure how to integrate the new version into my current Vim. Maybe I should start a different thread for this, since it's not Netrw specific.

            I deleted the old files mentioned on the Github mirror of Netrw (plugin/netrw*.vim autoload/netrw*.vim doc/pi_netrw.txt), but when I source the Vimball it installs the new ones into bundle/vundle (in plugin autoload and doc subdirectories).

            Since I use Vundle, my vimrc adds bundle/vundle to the runtimepath. I was going to delete the new files and try again without sourcing my vimrc (`vim -u NONE`), hoping it will install to the original locations. Is this the right approach?

            --
            --
            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@....
            For more options, visit https://groups.google.com/groups/opt_out.
          • Ben Fritz
            ... Well-designed plugins (netrw is one of them) prevent sourcing the plugin a second time. So in general, whichever one comes first in your runtimepath, is
            Message 5 of 9 , Jan 6, 2014
              On Monday, January 6, 2014 11:09:34 AM UTC-6, Ivan wrote:
              > On Monday, January 6, 2014 1:01:50 AM UTC-5, Charles Campbell wrote:
              > > Please try v150s of netrw, available at my website
              >
              > Cool, thank you! I'm not sure how to integrate the new version into my current Vim. Maybe I should start a different thread for this, since it's not Netrw specific.
              >
              > I deleted the old files mentioned on the Github mirror of Netrw (plugin/netrw*.vim autoload/netrw*.vim doc/pi_netrw.txt), but when I source the Vimball it installs the new ones into bundle/vundle (in plugin autoload and doc subdirectories).
              >
              > Since I use Vundle, my vimrc adds bundle/vundle to the runtimepath. I was going to delete the new files and try again without sourcing my vimrc (`vim -u NONE`), hoping it will install to the original locations. Is this the right approach?

              Well-designed plugins (netrw is one of them) prevent sourcing the plugin a second time. So in general, whichever one comes first in your runtimepath, is the one Vim will use. You can probably keep the version installed under bundle/vundle, and probably don't need to delete the old version from your vim install location.

              --
              --
              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@....
              For more options, visit https://groups.google.com/groups/opt_out.
            • Ivan
              ... Since I m installing from a Vimball rather than Vundle, I was worried (maybe unnecessarily) about Netrw being installed to the vundle directory. I suppose
              Message 6 of 9 , Jan 6, 2014
                On Monday, January 6, 2014 12:32:44 PM UTC-5, Ben Fritz wrote:
                > You can probably keep the version installed under bundle/vundle, and probably don't need to delete the old version from your vim install location.

                Since I'm installing from a Vimball rather than Vundle, I was worried (maybe unnecessarily) about Netrw being installed to the vundle directory. I suppose I could just use Vundle to install it from the github repo (which is a bit behind the Vimball, but I'm sure it'll catch up soon).

                The github repo also mentions a bug in the version that was distributed with Vim v7.0 that necessitates deleting those files in order to install a newer version. I'm on Vim 7.4 so maybe that doesn't apply, but I thought I'd remove them in case.

                --
                --
                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@....
                For more options, visit https://groups.google.com/groups/opt_out.
              • Gary Johnson
                ... I don t use Vundle, but I do install some plugins into their own directories and I modify rtp accordingly. To insure that plugins go where I want them,
                Message 7 of 9 , Jan 6, 2014
                  On 2014-01-06, Ivan wrote:
                  > On Monday, January 6, 2014 12:32:44 PM UTC-5, Ben Fritz wrote:
                  > > You can probably keep the version installed under bundle/vundle,
                  > > and probably don't need to delete the old version from your vim
                  > > install location.
                  >
                  > Since I'm installing from a Vimball rather than Vundle, I was
                  > worried (maybe unnecessarily) about Netrw being installed to the
                  > vundle directory. I suppose I could just use Vundle to install it
                  > from the github repo (which is a bit behind the Vimball, but I'm
                  > sure it'll catch up soon).

                  I don't use Vundle, but I do install some plugins into their own
                  directories and I modify 'rtp' accordingly. To insure that plugins
                  go where I want them, I set g:vimball_home in my ~/.vimrc before I
                  start mucking with 'rtp'.

                  let g:vimball_home = matchstr(&rtp, '^[^,]*')

                  Netrw is one of the plugins that I keep in its own directory, so to
                  make sure Vimball puts netrw in the right place, my ~/.vimrc also
                  includes the following.

                  au BufEnter netrw.vba,netrw.vba.gz,netrw.vba.bz2,netrw.vba.zip,netrw.vba.xz let g:vimball_home = $HOME."/.vim/netrw"
                  au BufEnter netrw.vmb,netrw.vmb.gz,netrw.vmb.bz2,netrw.vmb.zip,netrw.vmb.xz let g:vimball_home = $HOME."/.vim/netrw"

                  Those solutions assume that I install a vimballed plugin by
                  executing "vim someplugin.vmb" and do not install any other vimballs
                  in that same Vim session.

                  > The github repo also mentions a bug in the version that was
                  > distributed with Vim v7.0 that necessitates deleting those files
                  > in order to install a newer version. I'm on Vim 7.4 so maybe that
                  > doesn't apply, but I thought I'd remove them in case.

                  It shouldn't apply to you unless you had a private copy of netrw
                  dating from Vim 7.0.

                  Regards,
                  Gary

                  --
                  --
                  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@....
                  For more options, visit https://groups.google.com/groups/opt_out.
                • Ivan
                  ... Thanks Chip, it works! The tree view looks better too (I like the solid vertical lines). Thanks for your work and your help! -- -- You received this
                  Message 8 of 9 , Jan 6, 2014
                    On Monday, January 6, 2014 1:01:50 AM UTC-5, Charles Campbell wrote:
                    > Please try v150s of netrw, available at my website

                    Thanks Chip, it works! The tree view looks better too (I like the solid vertical lines). Thanks for your work and your help!

                    --
                    --
                    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@....
                    For more options, visit https://groups.google.com/groups/opt_out.
                  • Charles E Campbell
                    ... You re welcome! Its up to v150t already... Regards, Chip Campbell -- -- You received this message from the vim_use maillist. Do not top-post! Type your
                    Message 9 of 9 , Jan 6, 2014
                      Ivan wrote:
                      > On Monday, January 6, 2014 1:01:50 AM UTC-5, Charles Campbell wrote:
                      >> Please try v150s of netrw, available at my website
                      > Thanks Chip, it works! The tree view looks better too (I like the solid vertical lines). Thanks for your work and your help!
                      >
                      You're welcome! Its up to v150t already...

                      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@....
                      For more options, visit https://groups.google.com/groups/opt_out.
                    Your message has been successfully submitted and would be delivered to recipients shortly.