I wonder if you could use the Tree-sitter to select each level and update the range-specs option with the resulting selections.
There is a Kakoune integration called kak-tree for it.
I wonder if you could use the Tree-sitter to select each level and update the range-specs option with the resulting selections.
There is a Kakoune integration called kak-tree for it.
So I was thinking about how to do this and wrote this plugin kak-rainbower
Instead of taking only a part of the file I parse the whole file (and for c/cpp/rust I do some kind of string/comment checking)
I have no idea how to use kak-tree to do this (I would need something like a for loop in kakoune, and it will probably be slow), I was trying to write a rust version with tree-sitter but it does not detect some things automatically. I’m thinking about doing a hybrid of my approach and tree-sitter.
I’ve never written a plugin, so tell me what do you think of it
Nice plugin, new plugins for this keep popping up, very nice! One remark: currenly we have to put the rainbower binary on the path, it’s easier to refer to the binary using a relative path to the .kak file using the %val{source}
/$kak_source
value. See kakoune-python-bridge/python.kak at master · JJK96/kakoune-python-bridge · GitHub for an example usage.
Thanks for telling me this, I’ve updated the plugin to launch the executable from the same folder and added a command to compile it easily