nvim-orgmode / orgmode

Orgmode clone written in Lua for Neovim 0.9+.
https://nvim-orgmode.github.io/
MIT License
2.8k stars 121 forks source link

Application of colorscheme breaks todo keyword highlighting #720

Closed dtvillafana closed 1 month ago

dtvillafana commented 1 month ago

Describe the bug

If you apply a colorscheme the todo keyword highlighting breaks and highlights the whole heading line the same.

Steps to reproduce

  1. Open Neovim
  2. :e (edit) an org file
  3. notice the highlighting is working
  4. change the colorscheme, e.g., :colorscheme delek
  5. todo keywords are no longer highlighted separately from the headline

Expected behavior

the todo keywords should be highlighted differently from other tokens in the syntax.

Emacs functionality

NA

Minimal init.lua


local tmp_dir = vim.env.TMPDIR or vim.env.TMP or vim.env.TEMP or '/tmp'
local nvim_root = tmp_dir .. '/nvim_orgmode'
local lazy_root = nvim_root .. '/lazy'
local lazypath = lazy_root .. '/lazy.nvim'

-- Install lazy.nvim if not already installed
if not vim.loop.fs_stat(lazypath) then
    vim.fn.system({
        'git',
        'clone',
        '--filter=blob:none',
        'https://github.com/folke/lazy.nvim.git',
        '--branch=stable', -- latest stable release
        lazypath,
    })
end
vim.opt.rtp:prepend(lazypath)

require('lazy').setup({
    {
        'nvim-orgmode/orgmode',
        event = 'VeryLazy',
        ft = { 'org' },
        config = function()
            require('orgmode').setup()
        end,
    },
}, {
        root = lazy_root,
        lockfile = nvim_root .. '/lazy.json',
        install = {
            missing = false,
        },
    })

require('lazy').sync({
    wait = true,
    show = false,
})

Screenshots and recordings

No response

OS / Distro

WSL - Ubuntu 22.04.4 LTS; Artix Linux

Neovim version/commit

NVIM v0.10.0-dev-2849+g4946489e2

Additional context

NVIM v0.10.0-dev-2849+g4946489e2 Build type: RelWithDebInfo LuaJIT 2.1.1710088188

dtvillafana commented 1 month ago

this is a total guess but the bug might have to do something with how the highlights.scm file is generated and the highlight classes have '.' characters in them.

kristijanhusak commented 1 month ago

highlight groups gets cleared after colorscheme is changed. It is now reapplied after colorscheme is changed.

dtvillafana commented 1 month ago

Awesome, thank you!