Reputation: 9838
Suppose you'd like to open all the files in your checkout folder under the /trunk subdirectory. Assume the files are called first.c second.r third.cpp. How can you open all the files into vim with a single command.
The obvious answer is the following
$ vim first.c second.r third.cpp
But can you do this more simply?
Upvotes: 28
Views: 31927
Reputation: 4718
In addition to the answers given above, I'd like to point out that you can also do that from inside vim itself using
:args *
which sets the arglist to be the name of the files in the directory, and then you can display them in tabs with :tab all
(or you can use :argdo tabe
).
Upvotes: 11
Reputation: 7238
Edit all files using a given pattern:
vim `find . -name "*your*pattern*here*"`
Super useful when I do this:
vim `find . -name "*.go"`
Upvotes: 5
Reputation: 133
durum's answer is incomplete. To open all files in the directory without opening files in subdirectories, use this:
vim `find . -maxdepth 1 -type f`
Upvotes: 2
Reputation: 3404
The other answers will not work if you have subdirectories. If you need to open all files in all subdirectories you can use command substitution:
vim `find . -type f`
If you want to ignore files in subdirectories write:
vim `find . -type f -depth 1`
You can, of course, get as fancy as you want using the find
command.
Upvotes: 9
Reputation: 793
To edit all files in the current folder, use:
vim *
To edit all files in tabs, use:
vim -p *
To edit all files in horizontally split windows, use:
vim -o *
Upvotes: 32
Reputation: 3021
Sounds like you're on linux or some Unix variant. Using the asterisk gets you all files in the current folder:
$ vim *
Upvotes: 22