From 005c9b0ba7508c43c27e9fd960bc6179bd4cef39 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Thu, 13 Jul 2023 14:22:07 -0500 Subject: [PATCH] refactor(nvim): use rainbow-delimiters.nvim instead of ts-rainbow2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ts-rainbow2 is deprecated 😔 --- .../nvim/lua/plugins/configs/treesitter.lua | 20 ---------- dots/.config/nvim/lua/plugins/plugins.lua | 39 ++++++++++++++++++- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/dots/.config/nvim/lua/plugins/configs/treesitter.lua b/dots/.config/nvim/lua/plugins/configs/treesitter.lua index 8acdd5f0..34142ea1 100755 --- a/dots/.config/nvim/lua/plugins/configs/treesitter.lua +++ b/dots/.config/nvim/lua/plugins/configs/treesitter.lua @@ -42,26 +42,6 @@ nvim_treesitter.setup({ enable = true, }, indent = { enable = true }, - rainbow = { - enable = true, - query = { - "rainbow-parens", - html = "rainbow-tags", - latex = "rainbow-blocks", - tsx = "rainbow-tags", - vue = "rainbow-tags", - javascript = "rainbow-parens-react", - }, - 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, - }, - }, textobjects = { select = { enable = true, diff --git a/dots/.config/nvim/lua/plugins/plugins.lua b/dots/.config/nvim/lua/plugins/plugins.lua index aea1761f..432e037c 100755 --- a/dots/.config/nvim/lua/plugins/plugins.lua +++ b/dots/.config/nvim/lua/plugins/plugins.lua @@ -90,7 +90,6 @@ lazy.setup({ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", dependencies = { - { url = "https://gitlab.com/HiPhish/nvim-ts-rainbow2.git" }, "nvim-treesitter/nvim-treesitter-context", "nvim-treesitter/playground", "windwp/nvim-ts-autotag", @@ -102,6 +101,44 @@ lazy.setup({ end, }, + -- Rainbow braces/brackets/etc + { + url = "https://gitlab.com/HiPhish/rainbow-delimiters.nvim", + config = function() + local rainbow_delimiters = require("rainbow-delimiters") + vim.g.rainbow_delimiters = { + strategy = { + on_attach = function() + if vim.fn.line("$") > 10000 then + return nil + elseif vim.fn.line("$") > 1000 then + return rainbow_delimiters.strategy["global"] + end + return rainbow_delimiters.strategy["local"] + end, + }, + query = { + [""] = "rainbow-delimiters", + lua = "rainbow-blocks", + latex = "rainbow-blocks", + html = "rainbow-blocks", + javascript = "rainbow-delimiters-react", + tsx = "rainbow-parens", + verilog = "rainbow-blocks", + }, + highlight = { + "RainbowDelimiterRed", + "RainbowDelimiterYellow", + "RainbowDelimiterBlue", + "RainbowDelimiterOrange", + "RainbowDelimiterGreen", + "RainbowDelimiterViolet", + "RainbowDelimiterCyan", + }, + } + end, + }, + -- Dashboard when no file is given to nvim { "goolord/alpha-nvim",