Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lualine doesn't indicate when recording macro #1355

Open
ibootrc opened this issue Dec 31, 2024 · 3 comments
Open

Lualine doesn't indicate when recording macro #1355

ibootrc opened this issue Dec 31, 2024 · 3 comments

Comments

@ibootrc
Copy link

ibootrc commented Dec 31, 2024

when i start recording a macro nothing show up in lualine to let me know that i am recording.
my current config:

return {
	'nvim-lualine/lualine.nvim',
	config = function()
		local config = require("lualine")
		config.setup({
			options = {
				icons_enabled = true,
				theme = 'auto',
			}
		})

	end
}
@ibootrc
Copy link
Author

ibootrc commented Dec 31, 2024

I fixed that by doing so


   return {
	'nvim-lualine/lualine.nvim',
	config = function()
		local config = require("lualine")

		config.setup({
			options = {
				icons_enabled = true,
				theme = 'auto',
			},
			sections = {
				-- Add the macro recording status in the mode section
				lualine_a = {function()
					local reg = vim.fn.reg_recording()
					-- If a macro is being recorded, show "Recording @<register>"
					if reg ~= "" then
						return "Recording @" .. reg
					else
						-- Get the full mode name using nvim_get_mode()
						local mode = vim.api.nvim_get_mode().mode
						local mode_map = {
							n = 'NORMAL',
							i = 'INSERT',
							v = 'VISUAL',
							V = 'V-LINE',
							['^V'] = 'V-BLOCK',
							c = 'COMMAND',
							R = 'REPLACE',
							s = 'SELECT',
							S = 'S-LINE',
							['^S'] = 'S-BLOCK',
							t = 'TERMINAL',
						}

						-- Return the full mode name
						return mode_map[mode] or mode:upper()
					end
				end},
			},
		})
	end
}

@countless-integers
Copy link

countless-integers commented Jan 2, 2025

I took that and made it just show the macro state in the b section:

      {
        'macro',
        fmt = function()
          local reg = vim.fn.reg_recording()
          if reg ~= "" then
            return "Recording @" .. reg
          end
          return nil
        end,
        color = { fg = "#ff9e64" },
        draw_empty = false,
      },

I guess until this #1227 gets in.

@ibootrc
Copy link
Author

ibootrc commented Jan 8, 2025

@countless-integers That's elegant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants