当前位置:Linux教程 - 指令大全 - 指令大全 - vi同时编辑多个文件

指令大全 - vi同时编辑多个文件

vi同时编辑多个文件
2004-04-23 15:18 pm
来自:Linux文档
现载:Www.8s8s.coM
地址:无名

我有3个文件要同时编辑:文件是A.C,B.C和C.BAS,vi命令如何实现,vi中如何在这3个文件中进行切换?

vim可以在多分割窗口(multi-split-screen )环境下编辑多个文件。想了解有关详情可输入:help usr_08.txt。

要分割屏幕显示多个不同文件,在vi命令提示符后输入:

:split another-file
:vsplit another-file

不知道你在安装系统的时候是否装screen了?我装了,如果装了,直接打screen,然后Ctrl a + c 为创建新窗口,Ctrl a + p为在打开的]窗口中切换!可以开很多个!足够用!

1. Use vi to open the three file directly
for example
vi a b c

2.Then vi will open the file by the order you enter in the command line.
But current is a.
If you want to change to b, you must first save a, then press "2"
,then press "Ctl+Shift+^", for c, you must first save b, then press "3", then press "Ctrl+Shift+^".

vi a b c
:n跳至下一个文件,:e#回到刚才编辑的文件。
比如当前编辑文件为a,:n跳至b,再:n跳至c,:e#回到b,想回到a的话用:ea

我觉得用split 开窗口的好处,可以直接用yy在两个窗口之间复制
两个窗口可以同时是一个文件

其实可以在一个窗口下,打开3个文件的。

先 打开一个,vi 文件名
然后在vi的命令输入状态下输入
:sp 另外一个文件的路径及文件名

如此就可以在一个窗口打开3个文件了。
可以使用 ctrl + 两次按 w
在3个文件中切换