more stuff

This commit is contained in:
2025-09-16 00:34:25 -04:00
parent 9c7c46855c
commit 72d99537bf
9 changed files with 195 additions and 26 deletions

View File

@@ -52,11 +52,22 @@ end
--- Make an action lazy. This is mostly useful for keybinds which do a lot and
--- you want to make sure the screen doesn't flash
---@param txt string the action
---@return string lazified
---@param txt string|function the action
---@return string|function lazified
---@nodiscard
function M.lz(txt)
return "<cmd>se lz<CR>"..txt.."<cmd>se lz!<CR>"
if type(txt) == "string" then
return "<cmd>se lz<CR>"..txt.."<cmd>se lz!<CR>"
elseif type(txt) == "function" then
return function()
vim.cmd.se("lz")
-- gotta make sure we can always unset lz
pcall(txt)
vim.cmd.se("lz!")
end
else
return txt
end
end
return M