Rainbow parentheses for neovim using tree-sitter. Needs nvim-treesitter.
Tested languages - lua, java, clojure, fennel, python, css, rust, cpp. Should work with any language supported by nvim-treesitter. If any language is missing, please open an issue/PR.
This fork just adds the ability to change the colors of the matchs not only through hi 1 through 7 and in the file directly, but also with a key in the config.
require'nvim-treesitter.configs'.setup {
rainbow = {
enable = true,
extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean
colors = {}, -- Add your colors here, it overwrites the default colors at each index. (If less than 7, the remaining default colors will still be used.)
}
}
I've used the gruvbox palette because it is nice and subtle. I wanted to use VIBGYOR for an actual rainbow, but
- indigo and blue look the same.
- the colours were too bright and distracting.
To change the colours, edit lua/rainbow/colors.lua
. If you want to override only a few colours (you can only change colours 1 through 7 this way), you can do it in your init.vim: (thanks @delphinus !)
hi rainbowcol1 guifg=#123456
- Java
The screenshots below use a different colorscheme
- Fennel:
- C++:
- Latex (with tag begin-end matching)
Huge thanks to @vigoux, @theHamsta, @sogaiu, @bfredl and @sunjon and @steelsojka for all their help