Why
The statusline active function calls vim.api.nvim_set_hl three times on every cursor movement, doing redundant API work in one of Neovim's most frequently-invoked paths.
Current state
lua/config/plugins/specs/mini-statusline.lua defines opts.content.active as a function that calls vim.api.nvim_set_hl for MiniStatuslineFilename, MiniStatuslineLspServers, and MiniStatuslineDiagnostics on every invocation (lines 150–152). This function runs on every CursorMoved, ModeChanged, and related events.
Ideal state
MiniStatuslineFilename, MiniStatuslineLspServers, and MiniStatuslineDiagnostics highlight groups are set once at colorscheme setup time (e.g., in the catppuccin config callback).
- The
active function returns the composed statusline string without calling nvim_set_hl.
- Redraws do not make redundant API calls.
Out of scope
- Changing the colours or logic of the statusline components themselves.
Starting points
lua/config/plugins/specs/mini-statusline.lua — lines 150–152 where nvim_set_hl is called inside active
lua/config/plugins/specs/catppuccin.lua — where colorscheme-specific highlight overrides are set
QA plan
- Open Neovim and move the cursor rapidly — confirm the statusline renders correctly with expected highlight colours.
- Run
:lua vim.api.nvim_set_hl(0, 'MiniStatuslineFilename', {}) manually to clear the group, then move the cursor — expect the highlight to stay cleared (confirming nvim_set_hl is no longer called on redraw).
- Switch colorscheme and move the cursor — expect the custom highlights to reappear via the colorscheme config hook.
Done when
nvim_set_hl is not called inside the statusline active function; all three highlight groups are set at colorscheme-load time only.
Why
The statusline
activefunction callsvim.api.nvim_set_hlthree times on every cursor movement, doing redundant API work in one of Neovim's most frequently-invoked paths.Current state
lua/config/plugins/specs/mini-statusline.luadefinesopts.content.activeas a function that callsvim.api.nvim_set_hlforMiniStatuslineFilename,MiniStatuslineLspServers, andMiniStatuslineDiagnosticson every invocation (lines 150–152). This function runs on every CursorMoved, ModeChanged, and related events.Ideal state
MiniStatuslineFilename,MiniStatuslineLspServers, andMiniStatuslineDiagnosticshighlight groups are set once at colorscheme setup time (e.g., in the catppuccinconfigcallback).activefunction returns the composed statusline string without callingnvim_set_hl.Out of scope
Starting points
lua/config/plugins/specs/mini-statusline.lua— lines 150–152 wherenvim_set_hlis called insideactivelua/config/plugins/specs/catppuccin.lua— where colorscheme-specific highlight overrides are setQA plan
:lua vim.api.nvim_set_hl(0, 'MiniStatuslineFilename', {})manually to clear the group, then move the cursor — expect the highlight to stay cleared (confirmingnvim_set_hlis no longer called on redraw).Done when
nvim_set_hlis not called inside the statuslineactivefunction; all three highlight groups are set at colorscheme-load time only.