Skip to content

fix(theme): NeoVim body follows the variant, not just the tabline - #110

Merged
Rynaro merged 1 commit into
mainfrom
fix/nvim-body-follows-variant
Jun 9, 2026
Merged

Rynaro merged 1 commit into
mainfrom
fix/nvim-body-follows-variant

Conversation

@Rynaro

@Rynaro Rynaro commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Problem

Setting a non-dark variant (sepia/white) only recolored the NeoVim tabline — the editor body stayed dark blue.

Root cause — load order

alchemists-orchid.nvim (v2.0) ships plugin/alchemists-orchid.lua that eagerly runs setup() (its dark default) plus colorscheme alchemists-orchid. Vim sources plugin/** scripts after init.vim, so:

  1. init.vim sources generated/palette.vimsetup({mode='light'}) → body correctly becomes sepia/white.
  2. After init.vim, Vim auto-runs the plugin's plugin/*.luasetup() (dark) → body reverts to dark.

That step-2 colorscheme alchemists-orchid fires Potions' ColorScheme autocmd, which repaints only the barbar tabline / Visual / cheat groups from the variant tokens — so the tabline tracked the variant while the body did not. Exactly the reported symptom.

Proven empirically: under the real init.vim, Normal resolved to #2e3440 (dark); re-sourcing palette.vim flipped it to the parchment surface.

Fix

In the nvim adapter (.potions/lib/theme/adapters.sh):

  • Wrap the body apply in a re-callable global PotionsApplyOrchid() (still invoked immediately — so live :source / potions reload keeps winning, since no plugin pass follows a live source).
  • Add a startup-only VimEnter guard (has('vim_starting')) that re-asserts the variant after the plugin's eager pass, then re-asserts the component highlights on top.

Verification

End-to-end under the real init.vim, post-VimEnter:

variant Normal bg background
dark #2e3440 dark
white #fafbfc light
sepia #f5f0e6 light
  • 2 regression assertions added (palette ships PotionsApplyOrchid + the VimEnter re-assert).
  • 270 tests pass (268 + 2).
  • .version → 2.15.2, .checksums regenerated.

🤖 Generated with Claude Code

Setting a non-dark variant (sepia/white) only recolored the tabline; the
editor body stayed dark blue.

Root cause is load order. alchemists-orchid.nvim ships plugin/*.lua that
eagerly runs `setup()` (its dark default) plus `colorscheme
alchemists-orchid`, and Vim sources plugin/ scripts AFTER init.vim. So the
sequence was:

  1. init.vim sources generated/palette.vim → setup({mode='light'}) → body
     correctly becomes sepia/white.
  2. After init.vim, Vim auto-runs the plugin's plugin/*.lua → setup() (dark)
     → body reverts to dark.

The plugin's own `colorscheme alchemists-orchid` in step 2 fires Potions'
ColorScheme autocmd, which repaints only the barbar tabline / Visual / cheat
groups from the variant tokens — so the tabline tracked the variant while the
body did not. Exactly the reported symptom.

Fix: in the nvim adapter, wrap the body apply in a re-callable global
`PotionsApplyOrchid()` (still invoked immediately, so live `:source` /
`potions reload` keeps winning — no plugin pass follows a live source), and
add a startup-only `VimEnter` guard that re-asserts the variant after the
plugin's eager pass, then re-asserts the component highlights on top. The
guard is gated on `has('vim_starting')` so live re-sources skip it.

Verified end-to-end under the real init.vim: Normal resolves to #2e3440
(dark), #fafbfc (white), #f5f0e6 (sepia) for the three variants. Two
regression assertions lock in the re-assert guard. 270 tests pass.

Bump .version 2.15.2 + regenerate .checksums.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Rynaro
Rynaro merged commit f68b456 into main Jun 9, 2026
7 checks passed
@Rynaro
Rynaro deleted the fix/nvim-body-follows-variant branch June 9, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant