我可以使用gf
转到文件名称下/游标之后,是否有任何命令返回原始文件而不重新启动vim以打开它?
答案 0 :(得分:180)
尝试使用此快捷方式:
CTRL-^
Vim文档:help CTRL-^
:
CTRL-^ Edit the alternate file. Mostly the alternate file is the previously edited file. This is a quick way to toggle between two files. It is equivalent to ":e #", except that it also works when there is no file name.
:help alternate-file
如果已有当前文件名,则该文件名成为备用文件名 文件名。它可以在命令行上使用“#”|:_#|你可以使用 | CTRL- ^ |命令在当前文件和备用文件之间切换。 但是,当|:keepalt |时,备用文件名不会更改用来。 每个窗口都会记住备用文件名。
答案 1 :(得分:100)
尝试以下命令
:e#
它会将您带到存储在缓冲区中的先前打开的文件。
如果您通过键入多个gf
深入了解文件层次结构,则vim会将所有文件存储在编号的缓冲区中
然后,以下命令将带您进入缓冲区中的n
文件。 (n = 1,2,3,..)
:e#n