Monday, August 1, 2011

Re: netrw dir listing position

On Jul 30, 5:12 pm, Charles E Campbell Jr <drc...@campbellfamily.biz>
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

No comments: