[RDY] Refactor plugin system

This supersedes #1335, using funcrefs instead of autocommands to implement providers(it is cleaner and requires less changes).