在 Vim 中,什么是“备用文件"? [英] In Vim, what is the "alternate file"?

查看:40
本文介绍了在 Vim 中,什么是“备用文件"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在 Vim 中运行了 :help registers 并注意到 # '包含备用文件的名称'.

I just ran :help registers in Vim and noticed that # 'contains the name of the alternate file'.

我看过一个重命名文件的例子,如下所示:

I have seen an example for renaming files that goes like this:

" Save the current file, foo.txt, as bar.txt
:w bar.txt
" Start editing bar.txt
:e#

显然在这种情况下,您刚刚保存的文件是备用文件".

So apparently in that case, the file you just saved out is the "alternate file."

有人能给我一个更一般的替代文件"的定义吗?你还能用它做什么?

Can someone give me a more general definition for the "alternate file" and what else you might use it for?

推荐答案

备用文件是在当前窗口中最后编辑的文件.实际上,当您使用某些命令打开一个新缓冲区时,如果显示的缓冲区具有与之关联的文件名,则该文件名将被记录为备用文件名.

The alternate file is the file that was last edited in the current window. Actually when you use some command to open a new buffer, if the buffer that was displayed had a filename associated with it, that filename is recorded as alternate file name.

:helpalternate-file.

这篇关于在 Vim 中,什么是“备用文件"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆