-
-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(indent): added bracker-pair-colorizer plugin
- Loading branch information
Showing
3 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+450 KB
...trocommunity/indent/bracket-pair-colorizer/.readme/indent-colorizer-preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions
27
lua/astrocommunity/indent/bracket-pair-colorizer/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# bracket-pair-colorizer | ||
|
||
Provides rainbow indent guides that tie into their relevant bracket pairs, and a scope guide | ||
|
||
**Repository:** <https://github.com/lukas-reineke/indent-blankline.nvim> | ||
**Repository:** <https://gitlab.com/HiPhish/rainbow-delimiters.nvim> | ||
|
||
Adds rainbow indent guides to all indents that also align with the bracket for a given indent if available. | ||
|
||
Turns the bracket guide into a solid bold line when within the scope of a function/closure. | ||
|
||
Adds new mappings to toggle lines & scope highlighting. | ||
|
||
```lua | ||
["<leader>uI"] = { ":IBLToggle<cr>", desc = "Toggle Rainbow Indents" }, | ||
["<leader>uO"] = { ":IBLToggleScope<cr>", desc = "Toggle Scope Highlights" }, | ||
``` | ||
|
||
Scope higlighting functionality can be disabled by adding this command into your `init.lua` or simliar config: | ||
|
||
```lua | ||
vim.cmd(":IBLDisableScope") | ||
``` | ||
|
||
## Preview | ||
|
||
![indent-colorizer-preview](https://github.com/ammuench/astrocommunity-rainbow-higlights/blob/main/lua/astrocommunity/indent/bracket-pair-colorizer/.readme/indent-colorizer-preview.png?raw=true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
return { | ||
{ | ||
"HiPhish/rainbow-delimiters.nvim", | ||
main = "rainbow_delimiters", | ||
opts = {}, | ||
config = function() require("rainbow-delimiters.setup").setup {} end, | ||
}, | ||
{ | ||
"lukas-reineke/indent-blankline.nvim", | ||
main = "ibl", | ||
opts = {}, | ||
config = function() | ||
local highlight = { | ||
"RainbowRed", | ||
"RainbowYellow", | ||
"RainbowBlue", | ||
"RainbowOrange", | ||
"RainbowGreen", | ||
"RainbowViolet", | ||
"RainbowCyan", | ||
} | ||
|
||
local highlightIndent = { | ||
"RainbowRedIndent", | ||
"RainbowYellowIndent", | ||
"RainbowBlueIndent", | ||
"RainbowOrangeIndent", | ||
"RainbowGreenIndent", | ||
"RainbowVioletIndent", | ||
"RainbowCyanIndent", | ||
} | ||
|
||
local hooks = require "ibl.hooks" | ||
-- create the highlight groups in the highlight setup hook, so they are reset | ||
-- every time the colorscheme changes | ||
hooks.register(hooks.type.HIGHLIGHT_SETUP, function() | ||
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" }) | ||
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" }) | ||
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" }) | ||
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" }) | ||
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" }) | ||
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" }) | ||
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" }) | ||
vim.api.nvim_set_hl(0, "RainbowRedIndent", { fg = "#6e171e" }) | ||
vim.api.nvim_set_hl(0, "RainbowYellowIndent", { fg = "#765517" }) | ||
vim.api.nvim_set_hl(0, "RainbowBlueIndent", { fg = "#0c497a" }) | ||
vim.api.nvim_set_hl(0, "RainbowOrangeIndent", { fg = "#603d1d" }) | ||
vim.api.nvim_set_hl(0, "RainbowGreenIndent", { fg = "#3b5727" }) | ||
vim.api.nvim_set_hl(0, "RainbowVioletIndent", { fg = "#5a1b6d" }) | ||
vim.api.nvim_set_hl(0, "RainbowCyanIndent", { fg = "#1e4c52" }) | ||
end) | ||
|
||
vim.g.rainbow_delimiters = { highlight = highlight } | ||
require("ibl").setup { | ||
scope = { highlight = highlight, char = "┃" }, | ||
indent = { highlight = highlightIndent, char = "╎" }, | ||
} | ||
|
||
hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark) | ||
end, | ||
}, | ||
} |