我希望能够捕获所有修改vim缓冲区的事件,以便记录并将其发送到服务器。我想在插入模式下逐个字符地捕获事件,并在执行
p
或dd
等命令时得到通知---即文档发生更改的任何时间。p
或dd
等命令时得到通知---即文档发生更改的任何时间。TextChanged
TextChangedI
浏览了事件列表后,我选择了以下内容:
|BufFilePre| before changing the name of the current buffer
|BufFilePost| after changing the name of the current buffer
|FileChangedShell| Vim notices that a file changed since editing started
|FileChangedShellPost| After handling a file changed since editing started
|InsertEnter| starting Insert mode
|InsertChange| when typing <Insert> while in Insert or Replace mode
|InsertLeave| when leaving Insert mode
|QuickFixCmdPre| before a quickfix command is run
|QuickFixCmdPost| after a quickfix command is run
虽然我没有尝试过,但我相信 Insert*
事件包括像 d
elete、p
aste、c
hange 等命令。你还应该查找 |autocmd-events| 中的“Writing”事件。