Galaxyline changing mode colors for all buffers
sethen opened this issue · comments
Sethen Maleno commented
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?
Tommaso Laurenzi commented
I think you should create a short_line_left
version of ViMode
, like
('galaxyline').section.short_line_left[1] = {
SViMode = { ... }
This way it will be a different object and will not be updated with the mode of the current window, I think.
however, I don't really see the point of having ViMode indicators in inactive windows.