如何从vim中的oldfiles列表中打开文件?

Fre*_*Ben 14 vim

在vim中,我可以键入:oldfiles以查看我之前编辑过的文件列表.很棒的功能!

但现在我想从该列表中打开一个或多个文件到缓冲区.我怎样才能做到这一点?

mer*_*011 13

如果您使用:help oldfiles,您将找到:browse oldfiles应该执行您想要的命令.

:bro[wse] ol[dfiles][!]
                        List file names as with |:oldfiles|, and then prompt
                        for a number.  When the number is valid that file from
                        the list is edited.
                        If you get the |press-enter| prompt you can press "q"
                        and still get the prompt to enter a file number.
                        Use ! to abandon a modified buffer. |abandon|
                        {not when compiled with tiny or small features}
Run Code Online (Sandbox Code Playgroud)


rom*_*inl 13

一旦你在列表的底部,你应该按下:并发出一个命令,使用这个"怪异"的表示法:

:command #<91
Run Code Online (Sandbox Code Playgroud)

其中,command可以是任何的编辑风格的命令(:edit,:tabedit,:split,:vsplit,:next,:args,等),#<意思是"旧文件号......".

要编辑条目91,请使用:

:e #<91
Run Code Online (Sandbox Code Playgroud)

要编辑条目18,42和93,请使用:

:args #<18 #<42 #<93
Run Code Online (Sandbox Code Playgroud)