在命令行中,用vim可以一次性以不同方式打开多个文件。

-o水平方式打开文件:

$ vim -o file1 file2

显示效果为:

+++++++++++++++++++++++++++++
|                           |
|          file1            |
|                           |
|---------------------------|
|                           |
|          file2            |
|                           |
+++++++++++++++++++++++++++++

-O竖直方式打开文件:

$ vim -O file1 file2

显示效果为:

+++++++++++++++++++++++++++++
|            |              |
|            |              |
|            |              |
|   file1    |     file2    |
|            |              |
|            |              |
|            |              |
+++++++++++++++++++++++++++++

-p标签方式打开文件:

$ vim -p file1 file2

显示效果为:

+++++++++++++++++++++++++++++
|   tab1  |  tab2  |        |
|---------------------------|
|     |        |            |
|     v        v            |
|   file1    file2          |
|                           |
|                           |
|                           |
+++++++++++++++++++++++++++++

以上。