Disable line numbering in particular buffer

Let’s say I’m making a plugin, and I want to disable line numbering in the plugin’s buffer (and only in it).
And the user has a add-highlighter -override global/ number-lines -hlcursor setting in his kakrc.
How can i disable line numbering in a particular buffer without removing global highlighter?

I believe this is not possible, but I’ll be interested to see if anybody comes up with a solution.

The only way that I can think is instead of adding the highlighter globally, you add it on the buffer scope. Then you can either not add it for certain buffers, or remove it.

If I understood you correctly: you can use a WinCreate hook to add a “default” highlighter in window scope and then remove that highlighter in another, more specific WinCreate hook…

For example:

hook global WinCreate .* %{
    add-highlighter window/line-numbers number-lines

hook global WinCreate (.*/)?MyBuffer %{
    remove-highlighter window/line-numbers

That’s what I’m using in GitHub - kkga/ui.kak: Toggle UI highlighters in Kakoune.