什么是 .un~ 文件或者为什么 Vim 在终端中生成 .un~ 文件? [英] What is a .un~ file or or why does Vim in the Terminal make the .un~ file?

查看:19
本文介绍了什么是 .un~ 文件或者为什么 Vim 在终端中生成 .un~ 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到我有一些以 .un~ 结尾的点文件,例如我有一个 .vividchalk.vim.un~,但我不是确定那是从哪里来的.似乎它们是我在终端中使用 Vim 时创建的.这些文件是什么?当我关闭正在编辑的文件时,可以让它们自行删除吗?

I've noticed I have some dotfiles that end with .un~, for example I have a .vividchalk.vim.un~, but I'm not sure where that came from. It seems like they are created when I use Vim in the Terminal. What are these files? Can have them remove themselves when I close the file I'm editing?

推荐答案

当你编辑和保存文件时,Vim 创建一个与原始文件同名的文件,并在结束.

When you edit and save files, Vim creates a file with the same name as the original file and an un~ extension at the end.

Vim 7.3 包含了一个新的特性持久化撤销,即撤销信息退出 Vim 时不会丢失并保存在以 .un~ 结尾的文件中.你已经设置了 undofile 选项,所以 Vim 在保存时会创建一个撤销文件原始文件.您可以通过以下方式阻止 Vim 创建备份文件清除选项:

Vim 7.3 contains a new feature persistent undo, that is, undo information won't be lost when quitting Vim and be stored in a file that ends with .un~. You have set the undofile option, so Vim creates an undo file when saving the original file. You can stop Vim from creating the backup file, by clearing the option:

:set noundofile

请注意,默认情况下此选项是关闭的.你已经明确在其中一个初始化文件中启用了 undofile 选项.如果你希望您的撤消文件仅存储在特定目录中,您可以将 undodir 选项指向一个目录,该目录将包含您的所有聚合撤销文件.

Note that, by default this option is turned off. You have explicitly enabled the undofile option in one of the initialization files. If you want your undofiles to be stored only in a particular directory, you can point the undodir option to a directory that will contain all your aggregated undofiles.

来源:http://vimhelp.appspot.com/vim_faq.txt.html#faq-7.2

这篇关于什么是 .un~ 文件或者为什么 Vim 在终端中生成 .un~ 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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