Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim: run some code every time a buffer changes

Tags:

vim

I want to trap all events that modify the vim buffer, so I can record them and send them to a server. I want to trap character-by-character events while in insert mode, and also be notified when p or dd etc. commands are executed---any time the document changes.

like image 426
nornagon Avatar asked Feb 24 '23 05:02

nornagon


1 Answers

In Vim 8 this is much easier. Just listen to these to autocmd events:

TextChanged
TextChangedI
like image 178
XPlatformer Avatar answered Feb 26 '23 18:02

XPlatformer