Monday, March 18, 2019

vim buffer viewport changed

Hi all,

I've searched high and low for answers to my question, but I'm probably using the wrong term/concept so please bear with me in what follows!

As a spare-time experiment, I've pulled together a proof-of-concept Go based host/driver for Vim8 channel-based plugins (the channel implementation works really well BTW):

https://github.com/myitcv/govim

I'm using that as the basis for a channel-based plugin to support Go development in Vim:

https://github.com/myitcv/govim/tree/master/cmd/govim

Part of my experiment involves looking into whether using Go's standard library parser and AST (https://godoc.org/go) in combination with matchaddpos is a more efficient/effective way of syntax highlighting *.go files (particularly large ones).

I have a proof of concept of this working, but what I'm now looking to do is make the approach more efficient.

I'm using the TextChanged and TextChangedI events to trigger a re-parse; no problems there.

But I'm struggling to find the right combination of events/whatever to fire when the visible part (viewport?) of a buffer changes. For example, as a result of a page down, normal mode G jumping to the end of the buffer, gg to go to the top, etc. I want to use such an event to call matchaddpos to highlight the now-visible part of the buffer (which keeps the number of calls to matchaddpos down).

My searching thus far hasn't turned up much. Am I simply using the wrong search terms?

Any help/pointers much appreciated; please ask if you anything above needs to be clarified.

Thanks,


Paul

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: