tags:

views:

298

answers:

3

Is there a way to open all the files in a directory from within Vim? So a :command that would say in effect "Open all the files under /some/path into buffers".

Ideally, it would be great to open all the files under a dir recursively.

+12  A: 

The command you are looking for is args:

For example:

:args /path_to_dir/*

will open all files in the directory

skinp
Use `**` to match files recursively. E.g. `:args /path_to_dir/**`
daf
Perfect. Gracias.
Ethan
+2  A: 

Did you try

:n /some/path/*

It will open all files in /some/path

I don't think it'll open file recursively though.

EDIT

Maybe using ** will open recursively as daf mentionned

Luc M
Yeah, this works too.
daf
A: 

Why it doesn't work if I want to open all files ending with a certain extension? I tried

:n ./**.cs

and opens only the files in the currenty directory.

I found the answer.The correct code is :n **/*.cs

For more information :h find

mp