Is it possible to write a vim plugin that modifies buffer in real time? As a first step, would it for example be possible to modify syntax highlighting of unused variables as suggested in a similar sublime issue? I'm not talking about having personal static highlight config files, nor about setting up multiple vim rules. I think what I want to define custom personal rules but dynamically depending on the context and in a high level way independent of the language being edited. I would need to extract current buffers text and be able to modify them later on, after running some kind of logic in an external js server for example.
As far as I know
:h text-properties were designed with this in mind.
The main use for text properties is to highlight text. This can be seen as a replacement for syntax highlighting. Instead of defining patterns to match the text, the highlighting is set by a script, possibly using the output of an external parser. This only needs to be done once, not every time when redrawing the screen, thus can be much faster, after the initial cost of attaching the text properties.
... possibly using the output of an external parser.
Like some background process parses your buffer and provides info for vim to highlight text whatever needed.