1

Is there a way to select multiple files not one by one (with mf)?

  • I can see in the docs :MF command that do nothing for me. (:MF *.vim)
  • I also have tried mr supplying it *.vim$ in the folder full of vim files -- nothing happens

Or they do not work in windows?

1

Please try v1671 of netrw from my website. I agree that the fnameescape() should not be there: http://www.drchip.org/astronaut/vim/index.html#NETRW

| improve this answer | |
  • I have donwloaded vimball and I can see the same fnameescape there. – Maxim Kim Nov 19 '19 at 11:42
0

Ok, I had a time to check netrw code.

Looks like there is either a bug for a windows or just a bug (because it also doesn't work on my WSL debian).

The code in question is in function s:NetrwMarkFiles(islocal,...) on line 6660:

fun! s:NetrwMarkFiles(islocal,...)
"  call Dfunc("s:NetrwMarkFiles(islocal=".a:islocal."...) a:0=".a:0)
  let curdir = s:NetrwGetCurdir(a:islocal)
  let i      = 1
  while i <= a:0
   if a:islocal
    if v:version > 704 || (v:version == 704 && has("patch656"))
     let mffiles= glob(fnameescape(a:{i}),0,1,1)
    else
     let mffiles= glob(fnameescape(a:{i}),0,1)
    endif
   else
    let mffiles= [a:{i}]
   endif
"   call Decho("mffiles".string(mffiles),'~'.expand("<slnum>"))
   for mffile in mffiles
"    call Decho("mffile<".mffile.">",'~'.expand("<slnum>"))
    call s:NetrwMarkFile(a:islocal,mffile)
   endfor
   let i= i + 1
  endwhile
"  call Dret("s:NetrwMarkFiles")
endfun

There is fnameescape function used to provide parameter to glob function:

    if v:version > 704 || (v:version == 704 && has("patch656"))
     let mffiles= glob(fnameescape(a:{i}),0,1,1)
    else
     let mffiles= glob(fnameescape(a:{i}),0,1)
    endif

and it effectively escapes * in *.vim parameter so you can't select all .vim files.

fnameescape({string})                   *fnameescape()*
        Escape {string} for use as file name command argument.  All
        characters that have a special meaning, such as '%' and '|'
        are escaped with a backslash.
        For most systems the characters escaped are
--->    " \t\n*?[{`$\\%#'\"|!<".  For systems where a backslash
        appears in a filename, it depends on the value of 'isfname'.

And on the other hand netrw Help:

    * One may use the :MF command, which takes a list of
      files (for local directories, the list may include
      wildcards -- see |glob()|) >

        :MF *.c

Which is kind of fails due to escaping.

Not sure where it should be reported -- vim github or directly to Charles Campbel.

PS, reported https://github.com/vim/vim/issues/5239

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.