Vim缓冲区已被修改 [英] Vim Buffer has been modified

查看:84
本文介绍了Vim缓冲区已被修改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Vim中实现一个 AutoCmd ,当修改当前缓冲区时需要执行该命令。

I am trying to implement an AutoCmd in Vim that needs to be executed when the current buffer has been modified.

我已经阅读了文档中 AutoCmd 可用的所有事件,但是找不到可以帮助确定何时修改缓冲区的内容。

I have read through all the events available for AutoCmd in the docs but could not find something that would help determine when a buffer was modified or not.

这不一定意味着何时写入缓冲区,因为当缓冲区被修改后,需要调用我需要触发的动作,包括

This doesn't necessarily mean "when a buffer was written" because the action I need to trigger needs to be called when the buffer has been modified including being written.

任何有关如何实现 BufIsModified 的想法都可以实现这一目标吗?

Any ideas on how to implement a BufIsModified that could achieve this objective?

注意:不是不是什么是vimrc函数来确定缓冲区是否已被修改?,因为此问题与 autocmd 有关。 code>不仅是缓冲区修改过的检查

Note: not a duplicate of What is a vimrc function to determine if a buffer has been modified?, since this question is about an autocmd and not only the buffer modified check

解决方案

我唯一想到的就是使用 CursorMoved CursorMovedI 事件。

The only thing popped into my mind is to use the CursorMoved and CursorMovedI events.

HTH

这篇关于Vim缓冲区已被修改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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