Friday, October 7, 2011

Re: Netrw and filtering

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:
>
> :Explore ~/vimfiles/*.vim
> (nothing happens; no netrw window, no error message, nothing)
>
> :Explore $HOME/vimfiles/*.vim
> (same result; nothing happens)
>
> :Explore C:/Users/ben/vimfiles/*.vim
> (same result)
>
> :Explore /Users/ben/vimfiles/*.vim
> (same result)
>
> :Explore */~/vimfiles/*.vim
> (error message: **warning** (netrw) no files matched)
>
> :Explore */$HOME/vimfiles/*.vim
> (Netrw opens to the WRONG DIRECTORY, C:/Program Files/Vim/vim73/doc,
> showing all the .txt files therein)
>
> :Explore */C:/Users/ben/vimfiles/*.vim
> (error message: **warning** (netrw) no files matched)
>
> :Explore *//Users/ben/vimfiles/*.vim
> (C:/Program Files/vim/vim73/doc/arabic.txt opens with a statusline
> reading "Match 1 of 43"...I'm REALLY confused here)
>
> :Explore */Users/ben/vimfiles/*.vim
> (error message: **warning** (netrw) no files matched)
>
> 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.

Perhaps

:e /Users/ben/vimfiles
:Explore *.vim

will do one of the things you wanted.
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

No comments: