tags:

views:

69

answers:

1

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?

+2  A: 

Sounds like you're on linux or some Unix variant. Using the asterisk gets you all files in the current folder:

$ vim *
desau
stackoverflow is truly a wonder in the modern era. Your solution is simple, easy to remember and works.
Milktrader
@Milktrader, you do realise its a shell thing and not a vim thing, right?. How do you copy _all_ the files in a folder? `cp * /some/other/place`. How do you delete _all_ the files in a folder? `rm *` etc.
jeffjose
This will not open dot files by default. For all files you need `{,.}*` (in bash, assuming that exists at least one file that start with a dot) or `(|.)*` (in zsh, works even if there are no dot files).
ZyX
Check out the vim man page for some more info about using command line arguments to vim. I like `vim * -p` to open in tabs, or `vim -O fileA fileB` to open a couple of files in a split view. If they are similar I might use `vimdiff file{old,new}` to open them in a split view with the differences highlighted.
David Winslow
David - I will check out vim man now that I know that information lies therein, thanks. The extra information you posted is particularly useful. Jeff- I see how you characterize this as a shell question. vim and shell are very closely related so knowing one helps with operating the other. I characterized it as a vim question on the basis of accomplishing a specific task in vim, on which I was stumped. Next time I'll look for answers in shell and vim forums.
Milktrader