Zeioth/heirline-components.nvim

Idea: macro recording

Closed this issue · 2 comments

I don't plan on using this plugin because I have my own heirline implementation, but I wanted to share my macro recording block in case you want to add something to this plugin:

	local MacroRecording = {
		condition = conditions.is_active,
		init = function(self)
			self.reg_recording = fn.reg_recording()
			self.status_dict = vim.b.gitsigns_status_dict or { added = 0, removed = 0, changed = 0 }
			self.has_changes = self.status_dict.added ~= 0
				or self.status_dict.removed ~= 0
				or self.status_dict.changed ~= 0
		end,
		{
			condition = function(self)
				return self.reg_recording ~= ""
			end,
			{
				condition = function(self)
					return self.has_changes
				end,
				LeftSep,
			},
			{
				provider = "",
				hl = { fg = colors.autumnRed },
			},
			{
				provider = function(self)
					return "@" .. self.reg_recording
				end,
				hl = { italic = false, bold = true },
			},
			{
				Space,
			},
			{
				LeftSep,
				hl = { bg = active_background_color, fg = recording_background_color },
			},
			hl = { bg = recording_background_color, fg = active_background_color },
		},
		update = { "RecordingEnter", "RecordingLeave" },
	}

source: https://github.com/catgoose/nvim/blob/b14b59be4964289af09d82ed8a7a07c38e5b6537/lua/plugins/heirline.lua#L273C1-L312C3

Zeioth commented

Thank you for contributing @catgoose that's pretty awesome.

Heirline-components do that with the component cmd_info.

Oh nice I didn’t notice!