vim 可以实时监控文件的变化吗 [英] Can vim monitor realtime changes to a file

查看:39
本文介绍了vim 可以实时监控文件的变化吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题类似于这个如何在实时但我想在 vim 中做到这一点.我知道我可以使用 tail -f sample.xml 文件读取打开的文件,并且当新内容写入文件时,它也会将新内容写入我的屏幕.当文件更新时,我可以让 vim 自动填充新数据吗?

My question is similar to this how to monitor a text file in realtime but I want to do it in vim. I know I can read an opened file use tail -f sample.xml file, and when new content is written to the file, it'll also write the new content to my screen. Can I have vim automatically fill the new data when a file is updated?

推荐答案

您可以 :set autoread 以便 vim 在文件更改时读取文件.但是(取决于您的平台),您必须关注它.

You can :set autoread so that vim reads the file when it changes. However (depending on your platform), you have to give it focus.

来自帮助:

当检测到文件具有在 Vim 之外被改变,它在 Vim 内部没有改变,自动再读一遍.当...的时候文件已被删除,这不是完成.

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.

这篇关于vim 可以实时监控文件的变化吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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