[英]vim: detect underlying file change when entering insert mode
Here's a sequence of events:这是一系列事件:
vim
, make some edits, save it, and stay in normal mode;在vim
中打开一个文件,进行一些编辑,保存,并保持正常模式;git
;该文件被外部进程更改,例如git
;vim
, enter insert mode (at this point file has been changed, but vim
sees a stale version); Go 回到vim
,进入插入模式(此时文件已更改,但vim
看到的是旧版本);vim
.将文件保存在vim
中。 When I do things like above, what typically happens is that vim
warns me at step 5:当我执行上述操作时,通常会发生vim
在第 5 步警告我:
WARNING: The file has been changed since reading it!!!
Do you really want to write to it (y/n)?
This is rather inconvenient, because I already made some "valuable" edits.这很不方便,因为我已经做了一些“有价值的”编辑。 How can I ask vim
to do the check at step 3, that is, before entering insert mode, check if the buffer is outdated and offer to reload?如何让vim
做第3步的检查,即在进入insert模式前,检查buffer是否过期,并主动reload?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.