Added macro recording status to lualine

This commit is contained in:
2024-11-25 18:29:16 +01:00
parent d8c46723f2
commit 0a41349f1c

View File

@@ -130,6 +130,15 @@ return {
end
end
local function show_macro_recording()
local recording_register = vim.fn.reg_recording()
if recording_register == "" then
return ""
else
return "󰑋 " .. recording_register
end
end
local mode = {
"mode",
separator = { left = "", right = "" },
@@ -161,6 +170,11 @@ return {
},
color = { bg = mode, gui = "bold" },
}
local macro_recording = {
show_macro_recording,
color = { fg = "#333333", bg = "#ff6666" },
separator = { left = "", right = "" },
}
local harpoon = {
"harpoon2",
icon = "󰀱",
@@ -286,7 +300,7 @@ return {
lualine_a = { mode },
lualine_b = { filename, branch, "lsp-status" },
-- lualine_b = { branch, "lsp-status" },
lualine_c = { diagnostics, sep, harpoon },
lualine_c = { diagnostics, sep, macro_recording, harpoon },
-- lualine_c = { sep, harpoon },
lualine_x = { copilot, diff, fileformat, lazy, mason },
-- lualine_x = { copilot, fileformat, lazy, mason },
@@ -304,5 +318,24 @@ return {
tabline = {},
extensions = {},
})
vim.api.nvim_create_autocmd("RecordingEnter", {
callback = function()
lualine.refresh()
end,
})
vim.api.nvim_create_autocmd("RecordingLeave", {
callback = function()
local timer = vim.loop.new_timer()
timer:start(
50,
0,
vim.schedule_wrap(function()
lualine.refresh()
end)
)
end,
})
end,
}