Cursor line number mode indicator.
A small Neovim plugin that changes the color of your cursor's line number based on the current Vim mode.
Modicator has lualine.nvim support out of the box.
require('modicator').setup()
Note that modicator requires you to have termguicolors
, cursorline
, number
set. In Lua this is done by adding the following somewhere in your Neovim configuration:
vim.o.termguicolors = true
vim.o.cursorline = true
vim.o.number = true
Modicator sets the Normal mode highlight foreground based on the default foreground color of CursorLineNr
so if you're using a colorscheme make sure that it gets loaded before this plugin.
With lazy.nvim:
{
'mawkler/modicator.nvim',
dependencies = 'mawkler/onedark.nvim', -- Add your colorscheme plugin here
init = function()
-- These are required for Modicator to work
vim.o.cursorline = true
vim.o.number = true
vim.o.termguicolors = true
end,
opts = {}
}
Or with packer.nvim:
use {
'mawkler/modicator.nvim',
after = 'onedark.nvim', -- Add your colorscheme plugin here
setup = function()
-- These are required for Modicator to work
vim.o.cursorline = true
vim.o.number = true
vim.o.termguicolors = true
end,
config = function()
require('modicator').setup()
end
}
Modicator uses the following highlight groups for each mode, respectively:
NormalMode
InsertMode
VisualMode
CommandMode
ReplaceMode
SelectMode
TerminalMode
TerminalNormalMode
For more information on how to create a highlight group, see :help nvim_set_hl
.
require('modicator').setup({
-- Show warning if any required option is missing
show_warnings = true,
highlights = {
-- Default options for bold/italic
defaults = {
bold = false,
italic = false,
},
},
integration = {
lualine = {
enabled = true,
-- Letter of lualine section to use (if `nil`, gets detected automatically)
mode_section = nil,
-- Whether to use lualine's mode highlight's foreground or background
highlight = 'bg',
},
},
})
Modicator has built-in support lualine.nvim, meaning that if it detects lualine.nvim in your setup it will use the same colors for each mode as lualine.nvim uses. To disable this feature, you can set integration.lualine.enabled = false
in your modicator configuration.
Note that Modicator will only create a highlight group from a lualine.nvim mode highlight if that highlight group doesn't already exist.
Modicator tries to find your lualine mode section automatically. However, you can specify the section to use manually in integration.lualine.mode_section
, and whether to use the section highlight's bg
or fg
with integration.lualine.highlight
.
By default, marks.nvim highlights number lines with marks using CursorLineNr
, which makes all line numbers recolored by Modicator every time mode is changed.
To fix this issue, either set MarkSignNumHL
to something else, or remove the highlight group completely by putting the following snippet anywhere in your configuration:
local marks_fix_group = vim.api.nvim_create_augroup('marks-fix-hl', {})
vim.api.nvim_create_autocmd({ 'VimEnter' }, {
group = marks_fix_group,
callback = function()
vim.api.nvim_set_hl(0, 'MarkSignNumHL', {})
end,
})
To run test, run the following:
nvim --headless -u tests/init.lua -c "PlenaryBustedDirectory tests/ { minimal_init = 'tests/init.lua' }"