Giter Club home page Giter Club logo

nvim-ts-rainbow's Introduction

๐ŸŒˆ 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.

Warning/notice/whatever

The queries might be out of date at any time, keeping up with them for languages I don't use is not feasible. If you get errors like invalid node at position xxx, try removing this plugin first before opening an issue in nvim-treesitter. If it fixes the problem, open an issue/PR here.

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

nvim-ts-rainbow's People

Contributors

p00f avatar gelio avatar sunjon avatar github-actions[bot] avatar c-a-v-a avatar alexander-p30 avatar tzachar avatar thehamsta avatar aspeddro avatar hiphish avatar ram02z avatar qsdrqs avatar patrick96 avatar max397574 avatar dffdff2423 avatar delphinus avatar tbttfox avatar perigord-kleisli avatar stevenproctor avatar decodetalkers avatar reo101 avatar nfrid avatar joakker avatar lockejan avatar lf- avatar 6cdh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.