From 2c8ec0b5cbb585e2d02665eff9ad176bc765e2c4 Mon Sep 17 00:00:00 2001 From: Shaun Clayton Date: Sat, 20 Jul 2024 08:09:25 -0400 Subject: [PATCH] feat(indent-blankline): add which-key toggles --- lua/lazyvim/plugins/ui.lua | 80 ++++++++++++++++++++++++++++---------- 1 file changed, 59 insertions(+), 21 deletions(-) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index ed17182d..e96e78a8 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -225,28 +225,66 @@ 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() + local ibl = require("ibl") + local conf = require("ibl.config") + + LazyVim.toggle.map("ug", { + name = "Indention Guides", + get = function() + if conf.get_config(0).enabled then + return true + end + return false + end, + set = function(state) + if state then + ibl.setup_buffer(0, { enabled = true }) + else + ibl.setup_buffer(0, { enabled = false }) + end + end, + }) + LazyVim.toggle.map("uS", { + name = "Scope Highlight", + get = function() + if conf.get_config(0).scope.enabled then + return true + end + return false + end, + set = function(state) + if state then + ibl.setup_buffer(0, { scope = { enabled = true } }) + else + ibl.setup_buffer(0, { scope = { enabled = false } }) + end + 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", },