more stuff
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user