![禁用文件更改时加载文件的确认(MacVim)](https://linux22.com/image/1526332/%E7%A6%81%E7%94%A8%E6%96%87%E4%BB%B6%E6%9B%B4%E6%94%B9%E6%97%B6%E5%8A%A0%E8%BD%BD%E6%96%87%E4%BB%B6%E7%9A%84%E7%A1%AE%E8%AE%A4%EF%BC%88MacVim%EF%BC%89.png)
答案1
你可以通过以下方式实现大部分功能
:set autoread
从:h autoread
*'autoread'* *'ar'* *'noautoread'* *'noar'*
'autoread' 'ar' boolean (default off)
global or local to buffer |global-local|
{not in Vi}
When a file has been detected to have been changed outside of Vim and
it has not been changed inside of Vim, automatically read it again.
When the file has been deleted this is not done. |timestamp|
If this option has a local value, use this command to switch back to
using the global value: >
:set autoread<
因此这将使其自动读取除非你有本地修改。这是为了防止您丢失工作。
如果您希望它自动读取而不管是否有本地更改,您可以设置一个自动命令:
autocmd FileChangedShell * e! %
然而,这很可能会让你失去工作,所以我强烈建议不要这样做。