7

I previously found out, and posted, about how to load multiple buffers using :argadd instead of :badd. However, I would further like to add all files of all subdirectories matching a certain pattern. My current attempt looks like so:

:argadd !find . -name *.js -type f

But that adds

 51      "!find"                        line 1
 52      "~/Documents/neuro-sim/website/3.0" line 1
 53      "-name"                        line 1
 54      "*.js"                         line 1
 55      "-type"                        line 1
 56      "f"                            line 1

to the buffer. What modification do I have to make to make this work?

2 Answers 2

6

But why don't you do it with

:args **/*.js 

(Yeah, I know you can't filter for files this way...)

HTH

Sign up to request clarification or add additional context in comments.

5 Comments

will that recursively go through every subdirectory? Can I do :args /home/user/*.js?
@puk: no, but :args **/*.js will. See :help wildcards
Can you please put the **/*.js in the answer then I will accept this.
Thanks @Benoit, I wanted to write that :-)
I have too much e-courtesy. I should have edited it myself and pocketed the 2 rep points.
0

You need backticks "`" to evaluate the find and plug them into args. I agree it does seem strange to not use "!" but I think that is for handling stream buffers not args...

:arga `find . -name '*glob_pattern*'`

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.