Skip to content

Galaxyline changing mode colors for all buffers #213

@sethen

Description

@sethen

Having an issue that when I change a mode for one buffer all of them change. Here is a video for context:

Screencast.2021-08-24.17.23.08.mp4

As you can see when I go into insert mode and then press ESC it changes the mode on the next buffer, which is not what I want. Here is the code for context:

require('galaxyline').section.left[1] = {
	ViMode = {
		provider = function()
			local mode = vim.fn.mode()

			NVIM_MODES = {
				n = 'NORMAL',
				i = 'INSERT',
				c = 'COMMAND',
				v = 'VISUAL LINE',
				V = 'VISUAL',
				R = 'REPLACE',
			}

			NVIM_MODE_BACKGROUNDS = {
				n = colors.blue,
				i = colors.green,
				c = colors.yellow,
				v = colors.purple,
				V = colors.purple,
				R = colors.red
			}

			local modeColor = constants.NVIM_MODE_BACKGROUNDS[mode]
			local modeDisplay = constants.NVIM_MODES[mode]

			vim.api.nvim_command('hi GalaxyViMode gui=bold guibg=' .. modeColor .. ' guifg=' .. colors.grey3)

			return '  ' .. modeDisplay .. ' '
		end
	}
}

Is there something I am missing here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions