禁用 VIM 中的警告?
有没有办法禁用 VIM 中的警告?
特别是,当文件从只读变为可写时,我想禁用警告 12。 我有一个脚本可以打开文件进行编辑,但 vim 认为文件已更改并发出警告。
谢谢
Is there a way to disable warnings in VIM?
In particular, I want to disable Warning 12 when a file turns from read-only to writable. I have a script which opens the file for edit in perforce, but vim thinks the file has changed and issues a warning.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我已经使用
FileChangedRO
一段时间了,在开始编辑文件时自动检出文件,并发现 W12 警告也很烦人。 问题是 p4 edit 更新文件属性以删除只读标志。 如果作为初始编辑的一部分,您还更改了文件,Vim 会将其视为冲突,因为它不再是只读的。 这是我使用的解决方案,该解决方案对于使用FileChangedShell
更为保守,以防文件因其他原因在外部发生更改。I've been using
FileChangedRO
for a while now to automatically checkout files when starting to edit them and found the W12 warning annoying as well. The problem is that p4 edit updates the file attributes to remove the read only flag. If as part of the initial edit you also change the file, Vim sees this as a conflict since it's no longer read only. Here's the solution I use which is a bit more conservative about usingFileChangedShell
in case the file was changed externally for some other reason.我的 .vimrc 中有以下内容; 你应该只需要第二个。 它将消息回显到状态栏,而不是弹出对话框。
尝试
:help FileChangedShell
了解更多信息。I have the following in my .vimrc; you should only need the second one. It echoes the message to the status bar instead of popping up a dialog.
Try
:help FileChangedShell
for more information.将以下行添加到您的 .vimrc 文件中:
set autoread
这将禁用“只读到可写”警告
add the following line to your .vimrc file :
set autoread
This will disable "read-only to writeable" warnings