我是UNIX新手。我正在使用VI编辑器编写C编程代码。 如果我打开多个文件同时使用VI编辑器一样,如何在使用VI编辑器时在UNIX中的多个文件之间切换?
vi *.c
我只能编辑第一个文件。如果我按“:wq”,它会告诉我,有:“需要编辑的6个文件”
如何在这些文件之间切换?
我是UNIX新手。我正在使用VI编辑器编写C编程代码。 如果我打开多个文件同时使用VI编辑器一样,如何在使用VI编辑器时在UNIX中的多个文件之间切换?
vi *.c
我只能编辑第一个文件。如果我按“:wq”,它会告诉我,有:“需要编辑的6个文件”
如何在这些文件之间切换?
下一个文件::n
以前的文件::p
,:N
或:prev
这取决于VI执行你使用。
下面是一个典型的备忘单,其中有关于此主题的“文件”部分。
对于Linux红帽VI版本7.2.411使用:n和:N到下一个切换和以前。
也适用于Mac OS X(这是BSD)。不确定“真正的”BSD vi。 –
CentOS也是如此! – Poli
AIX的vi有它自己的命令;我花了一段时间才找到这些信息,因为这个问题的答案已经没有了,所以我会添加这个答案。
无论是:p
,:N
,也不:prev
工作要到前一个文件,你需要使用:n ---
命令的变化之一。
的:n
移动到下一个文件是一样的
使用:n file_name
移动到一个特定的文件(可以打开新的文件,这种方式太)(要转到以前的文件,只是这样做与前文件的名称
使用:n list of file names
定义文件的一个新的列表编辑(在这种情况下,文件list
,of
,file
,并且names
将使用:n
系列运行:n list of file names
其他有用的结果
:e File
Edits the specified file. If you are using this subcommand
from the ex editor, you do not need to type the : (colon).
:e!
Re-edits the current file and discards all changes.
:e + File
Edits the specified file starting at the end.
:e + Number File
Edits the specified file starting at the specified line number.
:e #
Edits the alternate file. The alternate file is usually the
previous file name before accessing another file with a
:e command. However, if changes are pending on the current
file when a new file is called, the new file becomes the
alternate file. This subcommand is the same as the Ctrl-A
subcommand.
Ctrl-G
Shows the current file name, current line number, number of
lines in the file, and percentage of the way through the
file where the cursor is located.
感谢tialaramex :) – Dinesh
是一些vi编辑器,:P不工作。使用:prev改为 – kingsmasher1