Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some syntax highlighting isn't applied when starting with light terminal background and 'flavour="auto"` #811

Open
rightaditya opened this issue Dec 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@rightaditya
Copy link

Description

When using a light-background terminal so that neovim automatically sets background to "light", some syntax highlighting doesn't work properly. In particular I've found that HTML bold and italic (this includes Markdown as well) don't get applied. I've reproduced this both with lazy.nvim (included repro.lua) as well as mini.deps, both with no other plugins or configuration beyond setting up the plugin manager, loading the plugin, and setting the colorscheme.

I've found three workarounds:

  • Explicitly set background to "light" in the config file, either before or after running colorscheme catppuccin.
  • Explicitly set flavour="latte" when loading the catppuccin plugin.
  • Don't run the colorscheme command from an config file; instead let the default colorscheme load and then set the colorscheme manually once the buffer is opened. (I guess an autocmd could do this.)

If I don't apply any of the workarounds and then try to change the colorscheme to another theme, or change background, the issue persists, even with colorschemes where this issue doesn't normally occur (including the other (dark) catppuccin flavours). The only way I've found to fix it is to quit nvim and apply one of the workarounds as above.

This problem doesn't seem to affect the other theme I tested, Rosé Pine.

Neovim version

NVIM v0.10.2
Build type: RelWithDebInfo
LuaJIT 2.1.1731601260

Terminal and multiplexer

GNOME terminal 3.54.2

Catppuccin version / branch / rev

faf15ab

Steps to reproduce

  1. Make sure terminal uses a light background so that nvim starts with background set to "light".
  2. nvim -u repro.lua

Expected behavior

expected

Actual behavior

actual

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "catppuccin/nvim",
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("catppuccin")
-- add anything else here
@rightaditya rightaditya added the bug Something isn't working label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant