Vim SWP文件干扰存储库vimdiff [英] Vim swp files interfere with repository vimdiff

查看:59
本文介绍了Vim SWP文件干扰存储库vimdiff的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的设置是使用vim(特别是在图形模式下的MacVim)编辑源文件,然后使用vimdiff(再次在图形模式下)进行(Mercurial)存储库差异.有时,当我进行比较时,vim会给我错误:

My setup is to use vim (specifically MacVim in graphical mode) to edit source files and then I do (mercurial) repository diffs using vimdiff (in graphical mode again). Sometimes, when I do a diff, vim gives me the error:

交换文件〜/nn/src/imm/model/injector_node/.values_table.py.swp"已经存在!

Swap file "~/nn/src/imm/model/injector_node/.values_table.py.swp" already exists!

我该如何解决?我可以命令vim停止制作swp文件,还是命令vimdiff忽略它们,或将其swp文件写入其他位置?

How do I fix this? Can I command vim to stop making swp files, or the vimdiff to ignore them, or write its swp files to a different place?

推荐答案

是的(也许),是的.

要关闭交换文件,请执行以下操作:

To turn off swap files:

set nobackup
set nowritebackup
set noswapfile

要更改交换文件的位置(我的首选):

To change location of swap files (my preferred choice):

" Set the directory of the swap file
" The // indicates that the swap name should be globally unique
set directory=~/.vim/tmp//,/tmp

在这里,将其设置在.vim下的tmp目录中.请参阅:h 'directory'找出该选项的每个部分代表什么.

Here I set it up in a tmp directory under .vim. See :h 'directory' to find out what each part of the option represents.

至于让Vimdiff忽略交换文件,我不太确定.但是可能发生此错误,因为当您使用Mercurial检查差异时,您已经在MacVim中打开了相同的文件.如果只是在执行差异之前关闭文件,那应该没问题.

As for getting Vimdiff to ignore the swap files, I'm not quite sure. But the error is probably occurring because when you're checking the diffs with Mercurial, you have the same files already open in MacVim. If you just close the files before performing the diff, then you should be fine.

这篇关于Vim SWP文件干扰存储库vimdiff的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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