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

Re: netrw dir listing position

Expand Messages
  • Bram Moolenaar
    ... I have the same problem, never took time to figure out how to fix it. Start Vim with: vim -u NORC -N Edit a directory with lots of files, move to halfway
    Message 1 of 11 , Jul 31, 2011
      Charles E Campbell Jr wrote:
      > >> Hi,
      > >>
      > >> Is there a way to make the netrw dir listing maintain
      > >> the cursor position?
      > >>
      > >> For example if I do a dir listing on a big dir, scroll down, and
      > >> press enter to edit a file, when I go back to the dir listing the
      > >> cursor is no longer at the file where I left it. The cursor
      > >> starts over at the top of the dir listing.
      > >>
      > >> This is a pain if I want to edit a handful of files chosen from
      > >> the netrw listing.
      > >>
      > >> Is there a way to maintain the cursor position in the dir listing?
      > >>
      > >>
      > > I'm afraid that I don't see this behavior using v143d of netrw. Please
      > > try upgrading netrw and see if you still have this problem.
      > >
      > > You may get v143d from:
      > > http://mysite.verizon.net/astronaut/vim/index.html#NETRW
      > >
      > I should mention that I tried both the wide listing and the default thin
      > listing when attempting to elicit this behavior. If the behavior
      > persists, please let me know what netrw settings you may have and any
      > more details that may be helpful.

      I have the same problem, never took time to figure out how to fix it.

      Start Vim with: vim -u NORC -N

      Edit a directory with lots of files, move to halfway the list.
      Press Enter, then :e #.
      I end up at the top of the listing.
      If after Enter I use CTRL-O I end up at the bottom of the listing.

      In both cases using '" takes me to where I wanted to be. Does netrw
      jump to the '" mark when opening a directory?

      --
      Windows
      M!uqoms

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ an exciting new programming language -- http://www.Zimbu.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --
      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
    • Steffen Prohaska
      On Jul 30, 5:12 pm, Charles E Campbell Jr ... I observe a similar problem in TREELIST mode with version 142. When I use, for
      Message 2 of 11 , Aug 1, 2011
        On Jul 30, 5:12 pm, Charles E Campbell Jr <drc...@...>
        wrote:
        > Charles E Campbell Jr wrote:
        >
        > > Sigma wrote:
        >
        > >> Is there a way to make thenetrwdirlistingmaintain
        > >> the cursorposition?
        >
        > >> For example if I do a dirlistingon a big dir, scroll down, and
        > >> press enter to edit a file, when I go back to the dirlistingthe
        > >> cursor is no longer at the file where I left it.  The cursor
        > >> starts over at the top of the dirlisting.
        >
        > >> This is a pain if I want to edit a handful of files chosen from
        > >> thenetrwlisting.
        >
        > >> Is there a way to maintain the cursorpositionin the dirlisting?
        >
        > > I'm afraid that I don't see this behavior using v143d ofnetrw.  Please
        > > try upgradingnetrwand see if you still have this problem.
        >
        > > You may get v143d from:
        > >http://mysite.verizon.net/astronaut/vim/index.html#NETRW
        >
        > I should mention that I tried both the widelistingand the default thinlistingwhen attempting to elicit this behavior.  If the behavior
        > persists, please let me know whatnetrwsettings you may have and any
        > more details that may be helpful.

        I observe a similar problem in TREELIST mode with version 142. When I
        use, for example, 'p'
        to preview a file, the cursor jumps in the list window to the first
        level directory that
        contains the file that I preview. As a quick fix, I added
        NetrwRestorePosn() to
        NetrwBrowseChgDir() (see diff below). I haven't checked if it has
        side effect. I also
        haven't tried 143d.

        Steffen

        The diff is against
        " Date: May 31, 2011
        " Version: 142
        which ships with MacVim snapshot 61.

        diff --git a/autoload/netrw.vim b/autoload/netrw.vim
        index ab6370a..c38d707 100644
        --- a/autoload/netrw.vim
        +++ b/autoload/netrw.vim
        @@ -3193,6 +3193,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
        " call Decho('case "handling a file": newdir<'.newdir.'> !~
        dirpat<'.dirpat.">")
        if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
        && exists("w:netrw_treedict")
        let dirname= s:NetrwTreeDir()
        + keepj call netrw#NetrwRestorePosn(nbcd_curpos)
        if dirname =~ '/$'
        let dirname= dirname.newdir
        else

        --
        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
      • Charles Campbell
        ... I should ve mentioned that I was using :Rex to return to the netrw window. I ve made a change to netrw (v143e); you may obtain it from my website:
        Message 3 of 11 , Aug 1, 2011
          Bram Moolenaar wrote:
          > Charles E Campbell Jr wrote:
          >
          >>>> Hi,
          >>>>
          >>>> Is there a way to make the netrw dir listing maintain
          >>>> the cursor position?
          >>>>
          >>>> For example if I do a dir listing on a big dir, scroll down, and
          >>>> press enter to edit a file, when I go back to the dir listing the
          >>>> cursor is no longer at the file where I left it. The cursor
          >>>> starts over at the top of the dir listing.
          >>>>
          >>>> This is a pain if I want to edit a handful of files chosen from
          >>>> the netrw listing.
          >>>>
          >>>> Is there a way to maintain the cursor position in the dir listing?
          >>>>
          >>>>
          >>>>
          >>> I'm afraid that I don't see this behavior using v143d of netrw. Please
          >>> try upgrading netrw and see if you still have this problem.
          >>>
          >>> You may get v143d from:
          >>> http://mysite.verizon.net/astronaut/vim/index.html#NETRW
          >>>
          >>>
          >> I should mention that I tried both the wide listing and the default thin
          >> listing when attempting to elicit this behavior. If the behavior
          >> persists, please let me know what netrw settings you may have and any
          >> more details that may be helpful.
          >>
          > I have the same problem, never took time to figure out how to fix it.
          >
          > Start Vim with: vim -u NORC -N
          >
          > Edit a directory with lots of files, move to halfway the list.
          > Press Enter, then :e #.
          > I end up at the top of the listing.
          > If after Enter I use CTRL-O I end up at the bottom of the listing.
          >
          > In both cases using '" takes me to where I wanted to be. Does netrw
          > jump to the '" mark when opening a directory?
          >
          >
          I should've mentioned that I was using :Rex to return to the netrw
          window. I've made a change to netrw (v143e); you may obtain it from my
          website:

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

          There may be side effects that I'm not currently aware of, however.

          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
        Your message has been successfully submitted and would be delivered to recipients shortly.