Closed mystilleef closed 1 year ago
What would you want this API to be like? Since you want to disable and enable it when changing modes how about three functions like this?
-- Disable rainbow for buffer (bufnr or 0 for current buffer)
rainbow_delimiters.disable(buffnr)
-- Enable rainbow again for buffer (bufnr or 0 for current buffer)
rainbow_delimiters.enable(buffnr)
-- Toggle rainbow for buffer (bufnr or 0 for current buffer)
rainbow_delimiters.enable(buffnr)
You could then call these functions in an autocommand for InsertEnter
and InsertLeave
.
Yes, those APIs are perfect.
-- Toggle rainbow for buffer (bufnr or 0 for current buffer)
rainbow_delimiters.enable(buffnr)
I assume you meant to write rainbow_delimiters.toggle(bufnr)
and not enable
. enable
should not toggle
to avoid confusion.
Try out the current master
; the functions are implemented now. And yes, that was a typo, I meant of toggle
of course.
Great work!
There's only 1 issue. Passing nothing to the APIs should automatically use the current buffer.
As it stands you're forced to pass a buffer number to the APIs which shouldn't be necessary. Public APIs in general should be nil
friendly.
Other than that after my 10 minutes of testing, it seems to work well.
Thank you!
I have made them nil
-tolerant now. I don't think that is a general think across Neovim functions, but on the other hand it barely adds any code, so went through with it anyway.
Neovim version
master
Language affected
No response
Query
No response
Strategy
No response
Description