Open all files in a folder

Suppose you want to open all the files in the scan folder in the / trunk subdirectory. Suppose the files are called first.c second.r third.cpp. How can you open all files in vim with a single command.

The obvious answer is

$ vim first.c second.r third.cpp

But can you make it easier?

+5
source share
3 answers

It looks like you are using Linux or some kind of Unix variant. Using an asterisk, you will receive all the files in the current folder:

$ vim *
+10
source

To edit all files in the current folder, use:

vim *

To edit all files on tabs, use:

vim -p *

To edit all files in horizontally divided windows, use:

vim -o *
+10
source

, . , :

vim `find . -type f`

, :

vim `find . -type f -depth 1`

You can, of course, look as good as you want using the command find.

0
source

All Articles