Friday, October 7, 2011

Re: Netrw and filtering

On Oct 7, 8:46 am, Charles Campbell <Charles.E.Campb...@nasa.gov>
wrote:
> Ben Fritz wrote:
> > I saw :help netrw-star and read that text to understand that netrw can
> > filter for files matching a pattern in a given directory.
>
> > But I cannot get it to work.
>
> > I tried: [lots of stuff...removed]
>
> > What am I doing wrong here? How am I supposed to use patterns with
> > netrw? And am I wrong about the filtering behavior?
>
>    :Explore */filespec  : does current directory matching to determine
> which, if any, of the files in the _current_ directory match your filespec
>    :Explore **/filespec : searches the current directory and its
> subdirectories for files which match your filespec
>    :Explore *//pattern  : searches the current directory for files which
> contain a match to the pattern
>    :Explore **//pattern : searches the current directory and its
> subdirectories for files which contain a match to the pattern
>
> Something like  :Explore */*.vim would match all *.vim files in your
> current directory.  :Explore **/*.vim will match all *.vim files in your
> current directory and in your current subdirectories.
>
> Another way to say this: putting path information into the filespec
> won't work.
>

Thanks, that clears things up quite a bit.

> Perhaps
>
> :e  /Users/ben/vimfiles
> :Explore *.vim
>
> will do one of the things you wanted.

Well, it at least acts in a sane way.

I do not one oddity, probably as a result of running on Windows.

:e ~/vimfiles
:Explore **/*.txt

Will allow me to jump between each *.txt file, but still shows all the
other files (ok...I'll deal). What is confusing is that I have the
following in my ~/vimfiles/doc folder:

| doc/
| | AnsiEsc.txt
| | cctree.txt
| | gundo.txt
| | hexEditor.txt
| | histwin.txt
| | LargeFile.txt
| | matchit.txt
| | RltvNmbr.txt
| | surround.txt
| | swap.txt
| | tagbar.txt
| | taglist.txt
| | tags
| | tohtml_wincp.txt
| | txtfmt.txt

First matched file is AnsiEsc.txt, then LargeFile.txt, then
RltvNmbr.txt (still around for when I use older Vims on a solaris
server we have at work), and only then does it go to cctree.txt,
gundo.txt, etc.

I.e. the navigation with <S-Down>/<S-Up> and/or :Nexplore :Pexplore
(thanks for displaying those mappings, by the way) goes in case-
sensitive order, whereas the sort order in the directory listing is in
case-insensitive order.

Now that I know why what I was trying will NOT work, I'm curious: is
there actually a way to filter a view to show only files matching a
given pattern?

I started this investigation while looking to improve
http://vim.wikia.com/wiki/Searching_for_files_in_a_directory_listing
to mention the tasks one could already accomplish with no custom
scripts. I had thought netrw could accomplish a lot of this, I now
believe this may have been incorrect.

--
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:

Post a Comment