如何防止vim创建(和离开)临时文件? [英] How to prevent vim from creating (and leaving) temporary files?

查看:34
本文介绍了如何防止vim创建(和离开)临时文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么vim会创建~文件?有没有办法禁用它?

Why does vim create <filename>~ files? Is there a way to disable that?

如果是用于备份(或其他),我会使用 git.

If it's for backup (or something), I use git for that.

此外,这些 ..swp 文件也是.

Also, these .<filename.with.path.hints>.swp files too.

我如何告诉 vim 不要创建这些,或者至少要自己清理?

How do I tell vim not to create those, or at the least to cleanup after itself?

编辑

哎呀,重复:

为什么 Vim 用 ~ 扩展名保存文件?

我采用了 rogeriopvl 的答案

逐字复制:

set nobackup       "no backup files
set nowritebackup  "only in case you don't want a backup file while editing
set noswapfile     "no swap files

推荐答案

我强烈建议继续使用交换文件(以防 Vim 崩溃).

I'd strongly recommend to keep working with swap files (in case Vim crashes).

您可以设置存储交换文件的目录,这样它们就不会弄乱您的正常目录:

You can set the directory where the swap files are stored, so they don't clutter your normal directories:

set swapfile
set dir=~/tmp

另见

:help swap-file

这篇关于如何防止vim创建(和离开)临时文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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