Handling keys, events, etc.¶
Vim’s scripting language provides several mechanisms to automatically respond to various events, including.
Special handling of key sequences (map.txt).
User defined commands (user-commands).
Auto commands events (autocmd.txt).
Timer events (timers)
Socket and pipe I/O (channel.txt).
Buffer changes (listener_add)
All of these commonly involve either snippets of Vim script or references to Vim functions that take specific arguments. This is obviously clean and pretty easy using Vim script, but frankly quite tricky when you want (for example) to map a key sequence to some Python code.
But it can be done.
VPE provides reasonably clean, Pythonic mechanisms, which are covered in the following sections.
Timers are covered in the section Timers and deferred actions.