Skip to content

🌈 Rainbow parentheses for neovim using tree-sitter 🌈

License

Notifications You must be signed in to change notification settings

hxlcyxn/nvim-ts-rainbow

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌈 nvim-ts-rainbow 🌈

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.

Setup

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.)
  }
}

Colours

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

Screenshots

  • Java

alt text

The screenshots below use a different colorscheme

  • Fennel:

alt text alt text

  • C++:

alt text

  • Latex (with tag begin-end matching)

alt text

Credits

Huge thanks to @vigoux, @theHamsta, @sogaiu, @bfredl and @sunjon and @steelsojka for all their help

About

🌈 Rainbow parentheses for neovim using tree-sitter 🌈

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scheme 55.7%
  • Lua 44.1%
  • Vim Script 0.2%