Skip to content

adoyle-h/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. This is a module for nvim-treesitter, not a standalone plugin. It requires and is configured via nvim-treesitter

Should work with any language supported by nvim-treesitter. If any language is missing, please open an issue/PR.

Only neovim nightly is targeted.

Installation and setup

Install and set up nvim-treesitter according to their documentation. Install this plugin, then add a rainbow section in the call to require("nvim-treesitter.configs").setup():

require("nvim-treesitter.configs").setup {
  highlight = {
      -- ...
  },
  -- ...
  rainbow = {
    enable = true,
    -- disable = { "jsx", "cpp" }, list of languages you want to disable the plugin for
    extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
    max_file_lines = nil, -- Do not enable for files with more than n lines, int
    -- colors = {}, -- table of hex strings
    -- termcolors = {} -- table of colour name strings
  }
}

If you want to enable it only for some filetypes and disable it for everything else, see p00f#30 (comment)

Colours

To change the colours you can set them in the setup:

require'nvim-treesitter.configs'.setup{
  rainbow = {
    -- Setting colors
    colors = {
      -- Colors here
    },
    -- Term colors
    termcolors = {
      -- Term colors here
    }
  },
}

If you want to override some colours (you can only change colours 1 through 7 this way), you can do it in your init.vim: (thanks @delphinus !). You can also use this while writing a colorscheme

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. https://sr.ht/~p00f/nvim-ts-rainbow preferred

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 74.2%
  • Scheme 12.1%
  • TypeScript 6.9%
  • JavaScript 6.5%
  • Vim Script 0.3%