neovim/neovim — pull request #762 by tarruda (2014-05-24 18:50:15+00:00)
Title: [RFC] API events

This implements the necessary server code for the plugin/event-handling infrastructure:

- Each API channel has a unique id, and the discover request now returns the [channel_id, metadata_blob] tuple.
- Two new functions were exposed to the vimscript land: `send_event(channel_id,event_type,data)` and `broadcast_event(event_type,data)`

Listening for vim events is then very simple:

```python
vim.command("au FileType python call send_event(%d, 'autocommand:filetype:python', {'buffer': bufnr('$')})" % vim.channel_id)
```

The API for registering handlers/waiting for events is client-specific. I'm going to start working on the python client today.