From a997152eb2307380888d640440e0732493f82727 Mon Sep 17 00:00:00 2001 From: Shaun Clayton Date: Sat, 20 Jul 2024 16:14:33 -0400 Subject: [PATCH] feat(indent-blankline): add which-key toggles (#4122) ## Description Add which-key toggle mappings for toggling both the indention guides, and also scope highlight on a per buffer basis. ## Screenshots ![2024-07-20_08-16](https://github.com/user-attachments/assets/7b282868-c035-4f71-97dd-5738cd953713) ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --------- Co-authored-by: Folke Lemaitre --- lua/lazyvim/plugins/ui.lua | 54 +++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index ed17182d..14807497 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -225,28 +225,40 @@ return { { "lukas-reineke/indent-blankline.nvim", event = "LazyFile", - opts = { - indent = { - char = "│", - tab_char = "│", - }, - scope = { show_start = false, show_end = false }, - exclude = { - filetypes = { - "help", - "alpha", - "dashboard", - "neo-tree", - "Trouble", - "trouble", - "lazy", - "mason", - "notify", - "toggleterm", - "lazyterm", + opts = function() + LazyVim.toggle.map("ug", { + name = "Indention Guides", + get = function() + return require("ibl.config").get_config(0).enabled + end, + set = function(state) + require("ibl").setup_buffer(0, { enabled = state }) + end, + }) + + return { + indent = { + char = "│", + tab_char = "│", }, - }, - }, + scope = { show_start = false, show_end = false }, + exclude = { + filetypes = { + "help", + "alpha", + "dashboard", + "neo-tree", + "Trouble", + "trouble", + "lazy", + "mason", + "notify", + "toggleterm", + "lazyterm", + }, + }, + } + end, main = "ibl", },