diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index f63cd21e..f7fe57d6 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -120,7 +120,7 @@ map("n", "ud", function() Util.toggle.diagnostics() end, { desc = "Toggl local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3 map("n", "uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" }) if vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint then - map( "n", "uh", function() Util.lsp.toggle_inline_hint() end, { desc = "Toggle Inlay Hints" }) + map( "n", "uh", function() Util.toggle.inlay_hints() end, { desc = "Toggle Inlay Hints" }) end map("n", "uT", function() if vim.b.ts_highlight then vim.treesitter.stop() else vim.treesitter.start() end end, { desc = "Toggle Treesitter Highlight" }) diff --git a/lua/lazyvim/util/lsp.lua b/lua/lazyvim/util/lsp.lua index 9eb9423e..b34a2afe 100644 --- a/lua/lazyvim/util/lsp.lua +++ b/lua/lazyvim/util/lsp.lua @@ -122,15 +122,4 @@ function M.format(opts) end end ----@param bufnr? number -function M.toggle_inline_hint(bufnr) - bufnr = bufnr or 0 - local inlay_hint = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint - if inlay_hint.enable then - vim.lsp.inlay_hint.enable(bufnr, not inlay_hint.is_enabled()) - else - vim.lsp.inlay_hint(bufnr, nil) - end -end - return M diff --git a/lua/lazyvim/util/toggle.lua b/lua/lazyvim/util/toggle.lua index b520070b..51e81744 100644 --- a/lua/lazyvim/util/toggle.lua +++ b/lua/lazyvim/util/toggle.lua @@ -53,6 +53,17 @@ function M.diagnostics() end end +---@param bufnr? number +function M.inlay_hints(bufnr) + bufnr = bufnr or 0 + local inlay_hint = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint + if inlay_hint.enable then + vim.lsp.inlay_hint.enable(bufnr, not inlay_hint.is_enabled()) + else + vim.lsp.inlay_hint(bufnr, nil) + end +end + setmetatable(M, { __call = function(m, ...) return m.option(...)