Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

Can't get the plugin to work #120

Open
ybbuc opened this issue Jul 12, 2022 · 13 comments
Open

Can't get the plugin to work #120

ybbuc opened this issue Jul 12, 2022 · 13 comments

Comments

@ybbuc
Copy link

ybbuc commented Jul 12, 2022

Describe the bug
Using the Neovim 0.7.2 and the latest treesitter, I cannot get it to color anything.

Steps to reproduce
Install plugin and configure, then nothing. See dotfiles

Expected behavior
Coloring nested enclosing characters like {{}}

Screenshots
CleanShot 2022-07-12 at 09 04 51

@p00f
Copy link
Owner

p00f commented Jul 12, 2022

Also paste the text

@p00f
Copy link
Owner

p00f commented Jul 12, 2022

It doesn't look like you require your plugins file? Does :PackerStatus show nvim-ts-rainbow?

@ybbuc
Copy link
Author

ybbuc commented Jul 12, 2022

It doesn't work for any text, not just that text. I can just write a bunch of curly brackets in a lua file and get nothing.
CleanShot 2022-07-12 at 12 57 44

@ybbuc
Copy link
Author

ybbuc commented Jul 13, 2022

Here's some nested tex code that should use the rainbow: \lim_{t\to0}\frac{1}{\sqrt{t^{2}+9}+3}

@p00f
Copy link
Owner

p00f commented Jul 13, 2022

works for me
image

Can't reproduce, sorry. I'll keep this open so that someone who has this issue can help

@cathaysia
Copy link

load plugins by this order:

  1. this plugin
  2. bufferline
  3. colorschema

this plugins will not work when

  1. this plugin
  2. colorschema
  3. bufferline

@cathaysia
Copy link

emm, It's weird that it doesn't work in my first Buffer, but the second one works fine. But like I said above, tweaking Bufferline and colorschema has a chance to make this plugin work

@ybbuc
Copy link
Author

ybbuc commented Jul 16, 2022

@cathaysia Appreciate the suggestion, but no dice. I wonder if it's because I'm not using Neovim nightly.

@kostafey
Copy link

kostafey commented Sep 6, 2022

Can reproduce for both NVIM v0.7.2 and NVIM v0.8.0-dev+1027-g4bf005e9f.
plugins.lua:

vim.cmd [[packadd packer.nvim]]

return require('packer').startup(function(use)
  -- Packer can manage itself
  use 'wbthomason/packer.nvim'

  use 'nvim-treesitter/nvim-treesitter'
  require("nvim-treesitter.configs").setup {
    ensure_installed = { "c", "lua", "rust", "java", "clojure" },
     -- Automatically install missing parsers when entering buffer
    auto_install = true,
    highlight = {        
	    enable = true,
      additional_vim_regex_highlighting = false,
    },
    rainbow = {
      enable = true,
      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 = {"#666666", "#5544EE", "#2265DC", "#00A89B", "#229900", "#999900", "#F57900", "#EE66E8"}, -- table of hex strings
      -- termcolors = {} -- table of colour name strings
    }
  }
  -- Colorscheme
  use 'kostafey/organicgreen.nvim'
  vim.cmd[[colorscheme organicgreen]]
end)

:PackerStatus

                packer.nvim - Total plugins: 7
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 • neovim-session-manager
 • notifier.nvim
 • nvim-colorizer.lua
 • organicgreen.nvim
 • packer.nvim
 • plenary.nvim
 • telescope.nvim

No highlight brackets:
image

adoyle-h added a commit to adoyle-h/nvim-ts-rainbow that referenced this issue Sep 8, 2022
If you defined `{colors = { "#cc241d", "#a89984" }, termcolors = {}}`, you can't reproduce the issue.
Because there are seven colors and termcolors in default config.

If you defined colors more than seven,

    colors = { "#cc241d", "#a89984", "#b16286", "#d79921", "#689d6a", "#d65d0e", "#458588", "#005f87" },
    termcolors = {},

Or colors' length more than termcolors',

    colors = { "#cc241d", "#a89984"},
    termcolors = { 3 },

then the issue can be reproduced.

close p00f#120
@adoyle-h
Copy link

adoyle-h commented Sep 8, 2022

If you defined {colors = { "#cc241d", "#a89984" }, termcolors = {}}, you can't reproduce the issue. Because there are seven colors and termcolors in default config.

colors = {
"#cc241d",
"#a89984",
"#b16286",
"#d79921",
"#689d6a",
"#d65d0e",
"#458588",
},
termcolors = {
"Red",
"Green",
"Yellow",
"Blue",
"Magenta",
"Cyan",
"White",
},

If you defined colors more than seven,

colors = { "#cc241d", "#a89984", "#b16286", "#d79921", "#689d6a", "#d65d0e", "#458588", "#005f87" },
termcolors = {},

Or colors' length more than termcolors',

colors = { "#cc241d", "#a89984"},
termcolors = { 3 },

then the issue can be reproduced.

local s = string.format(
"highlight default rainbowcol%d guifg=%s ctermfg=%s",
i,
colors[i],
termcolors[i]
)
vim.cmd(s)

When termcolors[i] is nil, setting highlight group will fail.

@kostafey
Copy link

kostafey commented Sep 10, 2022

adoyle-h looks like I'm doing something completely wrong. But I can't enable plugin for seven colors too. The same story if I remove colors and termcolors lines from config at all.

nvim --version
NVIM v0.8.0-dev+1027-g4bf005e9f

:PackerStatus

                packer.nvim - Total plugins: 2
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 • nvim-treesitter
 • packer.nvim

The total config for test case:
~/.config/nvim/init.vim:

lua require('plugins')

~/.config/nvim/lua/plugins.lua:

vim.cmd [[packadd packer.nvim]]

return require('packer').startup(function(use)
  -- Packer can manage itself
  use 'wbthomason/packer.nvim'

  use 'nvim-treesitter/nvim-treesitter'
  -- use 'p00f/nvim-ts-rainbow'
  require("nvim-treesitter.configs").setup {
    ensure_installed = { "c", "lua", "rust", "java", "clojure" },
     -- Automatically install missing parsers when entering buffer
    auto_install = true,
    highlight = {        
	    enable = true,
      -- additional_vim_regex_highlighting = false,
    },
    rainbow = {
      enable = true,
      colors = { 
        "#cc241d", 
        "#a89984", 
        "#b16286", 
        "#d79921", 
        "#689d6a", 
        "#d65d0e", 
        "#458588", 
    }, 
    termcolors = { 
        "Red", 
        "Green", 
        "Yellow", 
        "Blue", 
        "Magenta", 
        "Cyan", 
        "White", 
    },
    }
  }
end)

Result:
image

@p00f
Copy link
Owner

p00f commented Sep 11, 2022

use 'p00f/nvim-ts-rainbow is commented out @kostafey

@kostafey
Copy link

@p00f oh, really. It works now. Thank you!

adoyle-h added a commit to adoyle-h/nvim-ts-rainbow that referenced this issue Sep 14, 2022
If you defined `{colors = { "#cc241d", "#a89984" }, termcolors = {}}`, you can't reproduce the issue.
Because there are seven colors and termcolors in default config.

If you defined colors more than seven,

    colors = { "#cc241d", "#a89984", "#b16286", "#d79921", "#689d6a", "#d65d0e", "#458588", "#005f87" },
    termcolors = {},

Or colors' length more than termcolors',

    colors = { "#cc241d", "#a89984"},
    termcolors = { 3 },

then the issue can be reproduced.

close p00f#120
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants