如何让 Mercurial 忽略 Vim 的 .swp 文件?
当我在 vim 中打开一些文件时,我尝试进行一些更改,并在提交、合并和排序时,最终得到:
alex@adebian:~/cs4290/p3$ hg status
R test
! project3_framework/protocols/.MI_protocol.cpp.swp
! project3_framework/protocols/.MSI_protocol.cpp.swp
我在项目中添加了一个 .hgignore
文件,其中包含以下内容:
syntax: glob
*.cpp.swp
我已经关闭了 vim 会话(删除文件),但文件仍然显示。如何让 Mercurail 忽略 .swp 文件?
I tried to pull some changes while I had some files opened in vim, and while committing and merging and the sort, ended up coming up with:
alex@adebian:~/cs4290/p3$ hg status
R test
! project3_framework/protocols/.MI_protocol.cpp.swp
! project3_framework/protocols/.MSI_protocol.cpp.swp
I added a .hgignore
file in my project with the following:
syntax: glob
*.cpp.swp
I've since closed my vim session (removing the files) yet the files keep showing up. How do I get mercurail to ignore the .swp files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
!
符号表示 Mercurial 找不到已添加到存储库中的文件。因此,您首先需要忘记
或删除
这些文件。之后 - 它们将不再出现在status
中,因为您已忽略它们。!
sign means that mercurial cannot find the file that has been already added to the repository. So you need toforget
orremove
those files at first. After that - they will not appear anymore in thestatus
since you have ignored them.我同意 zerkms 的观点...
忘记
或删除
这些文件以摆脱!
。此外,您可能已经注意到,仅创建包含某些内容的 .hgignore 文件不会遍历存储库并删除匹配的文件。如果您已将foo.c
添加到项目中,然后创建以下 .hgignore:foo.c
仍将是项目的一部分 - 您需要明确删除它。I agree with zerkms...
forget
orremove
those files to get rid of the!
. Also, as you've probably noticed, simply creating a .hgignore file with some content does not go through the repository and remove matching files. If you've addedfoo.c
to your project and then you create the following .hgignore:foo.c
will still be a part of the project - you would need to remove it explicitly.您可以使用
设置目录=c:\\workfiles\\
在 .vimrc 中将交换文件写入“特殊”文件夹中
You can use
set directory=c:\\workfiles\\
in your .vimrc to write swap files in a "special" folder