From 7985f743f34d93e11e46730afa8a2862fd9d2d27 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Thu, 2 Mar 2023 19:43:11 -0600 Subject: [PATCH] feat(nvim): use ts-rainbow2 plugin --- .../primary/config/lua/plugins/configs/kanagawa.lua | 7 +++++++ .../config/lua/plugins/configs/treesitter.lua | 12 ++++++++++-- .../primary/config/lua/plugins/plugins.lua | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/dots/.nvim-environments/primary/config/lua/plugins/configs/kanagawa.lua b/dots/.nvim-environments/primary/config/lua/plugins/configs/kanagawa.lua index 7c5426be..ed5ee80c 100644 --- a/dots/.nvim-environments/primary/config/lua/plugins/configs/kanagawa.lua +++ b/dots/.nvim-environments/primary/config/lua/plugins/configs/kanagawa.lua @@ -121,6 +121,13 @@ require("kanagawa").setup({ Folded = { bg = colors.waveBlue1 }, UfoFoldedBg = { bg = "NONE" }, + + TSRainbowRed = { fg = colors.peachRed }, + TSRainbowYellow = { fg = colors.carpYellow }, + TSRainbowBlue = { fg = colors.crystalBlue }, + TSRainbowGreen = { fg = colors.springGreen }, + TSRainbowViolet = { fg = colors.oniViolet }, + TSRainbowCyan = { fg = colors.lightBlue } }, }) diff --git a/dots/.nvim-environments/primary/config/lua/plugins/configs/treesitter.lua b/dots/.nvim-environments/primary/config/lua/plugins/configs/treesitter.lua index de8b1aa1..47e5ff9f 100755 --- a/dots/.nvim-environments/primary/config/lua/plugins/configs/treesitter.lua +++ b/dots/.nvim-environments/primary/config/lua/plugins/configs/treesitter.lua @@ -15,8 +15,16 @@ nvim_treesitter.setup({ }, rainbow = { enable = true, - extended_mode = true, - max_file_lines = nil, + query = "rainbow-parens", + strategy = { + on_attach = function() + if vim.fn.line('$') < 1000 then + require("ts-rainbow.strategy.local") + elseif vim.fn.line('$') < 10000 then + require("ts-rainbow.strategy.global") + end + end + }, }, }) diff --git a/dots/.nvim-environments/primary/config/lua/plugins/plugins.lua b/dots/.nvim-environments/primary/config/lua/plugins/plugins.lua index cc637103..d2f033f1 100755 --- a/dots/.nvim-environments/primary/config/lua/plugins/plugins.lua +++ b/dots/.nvim-environments/primary/config/lua/plugins/plugins.lua @@ -93,7 +93,7 @@ lazy.setup({ event = "VeryLazy", build = ":TSUpdate", dependencies = { - "p00f/nvim-ts-rainbow", + { url = "https://gitlab.com/HiPhish/nvim-ts-rainbow2.git" }, "nvim-treesitter/nvim-treesitter-context", }, config = function()