vis icon indicating copy to clipboard operation
vis copied to clipboard

Events

Open gavlooth opened this issue 7 years ago • 6 comments

Is there a way to Detect changes to a buffer? The lua api doesn't seem to include any events related to that except from detecting single key inputs in insert or replace mode. This really blocks me from making some plugins. I have created a parinfer plugin (that doesn't balance parens if you try to delete them), and also it is not possible to use the rust-parinfer

gavlooth avatar Apr 14 '18 13:04 gavlooth

combining vis.events.WIN_HIGHLIGHT vis.win.file.modified seems to do the trick of detecting changes on a buffer

gavlooth avatar Apr 16 '18 04:04 gavlooth

If someone is interested, I have manage to wrap parinfer-rust to create a vis-parinfer plugin. Now vis has structural editing :)

gavlooth avatar Apr 16 '18 17:04 gavlooth

Hi, you can link to plugins in the Wiki Plugins page

erf avatar Apr 16 '18 20:04 erf

As soon as it is stable. It seems that subscribing to WIN_HIGHLIGHT event turns syntax highlight off until the file is saved. Is that how it supposed to work?

gavlooth avatar Apr 17 '18 03:04 gavlooth

Seems that updating text line per line thought the highlight event halts highlighting More specifically this happens when i get a response text from parinfer and then update the lines that have changed: for s in response["text"]:gmatch("([^\n]*)\n?") do if old_lines[n]~=s then old_lines[n]=s end n=n+1 end A work around was to trigger the highlight event a second time.

gavlooth avatar Apr 17 '18 07:04 gavlooth

Maybe rename this issue to "Lua API: Detect buffer changes".

This should help the LSP implementation mentioned in issue 853 and in vis-lspc

erf avatar May 03 '22 22:05 erf