Giter Site home page Giter Site logo

salfum / nvim-ts-rainbow2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hiphish/nvim-ts-rainbow2

0.0 0.0 0.0 1.24 MB

Rainbow delimiters for Neovim through Tree-sitter

Home Page: https://gitlab.com/HiPhish/nvim-ts-rainbow2

License: Apache License 2.0

Shell 0.39% JavaScript 1.71% C++ 1.23% Scheme 29.23% Python 0.82% C 0.88% Java 0.40% Common Lisp 0.27% Lua 46.79% Haskell 1.31% Clojure 0.23% R 0.32% Go 2.26% C# 4.23% Racket 0.93% Rust 4.02% Julia 0.12% Dart 1.71% TypeScript 3.05% CSS 0.10%

nvim-ts-rainbow2's Introduction

Rainbow delimiters for Neovim

This Neovim plugin provides alternating syntax highlighting (“rainbow parentheses”) for Neovim, powered by Tree-sitter. The goal is to have a hackable plugin which allows for different configuration of queries and strategies, both globally and per file type. Users can override and extend the built-in defaults through their own configuration.

Installation and setup

Installation

The plugin depends on nvim-treesitter. Other than that it is installed like any other Neovim plugin.

Setup

Since this is a module for nvim-treesitter you need to setup everything in its configuration. Here is an example:

require('nvim-treesitter.configs').setup {
  rainbow = {
    enable = true,
    -- list of languages you want to disable the plugin for
    disable = { 'jsx', 'cpp' },
    -- Which query to use for finding delimiters
    query = 'rainbow-parens',
    -- Highlight the entire buffer all at once
    strategy = require('ts-rainbow').strategy.global,
  }
}

Please refer to the manual for more details.

Help wanted

There are only so many languages which I understand to the point that I can write queries for them. If you want support for a new language please consider contributing code. See the CONTRIBUTING for details.

Status of the plugin

Tree-sitter support in Neovim is still experimental. This plugin and its API should be considered stable insofar as breaking changes will only happen if changes to Neovim necessitates them.

Warning

There is currently a shortcoming in Neovim's Tree-sitter API which makes it so that only the first node of a capture group can be highlighted. Please see neovim/neovim#17099 for details. Affected queries:

  • HTML rainbow-parens
  • JSX (Javascript + React.js) rainbow-parens-react (affects React tags only)
  • Python (rainbow-parens) (affects only the for ... in inside comprehensions)
  • TSX (Typescript + React.js) rainbow-parens-react (affects React tags only)
  • Vue.js rainbow-parens

Most of these are related to HTML-like tags, so you can use an alternative query instead. See the manual (:h ts-rainbow-query) for a list of extra queries.

Screenshots

Bash

https://user-images.githubusercontent.com/4954650/212133420-4eec7fd3-9458-42ef-ba11-43c1ad9db26b.png

C

https://user-images.githubusercontent.com/4954650/212133423-8b4f1f00-634a-42c1-9ebc-69f8057a63e6.png

Common Lisp

https://user-images.githubusercontent.com/4954650/212133425-85496400-4e24-4afd-805c-55ca3665c4d9.png

Java

https://user-images.githubusercontent.com/4954650/212133426-7615f902-e39f-4625-bb91-2e757233c7ba.png

LaTeX

Using the blocks query to highlight the entire \begin and \end instructions.

https://user-images.githubusercontent.com/4954650/212133427-46182f57-bfd8-4cbe-be1f-9aad5ddfd796.png

License

Licensed under the Apache-2.0 license. Please see the LICENSE file for details.

Attribution

This is a fork of a previous Neovim plugin, the original repository is available under https://sr.ht/~p00f/nvim-ts-rainbow/.

Attributions from the original author

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

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.