nvim-orgmode / orgmode

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

Setting org_todo_keyword_faces results in error #416

Closed bronzehedwick closed 2 years ago

bronzehedwick commented 2 years ago

Describe the bug

When setting the org_todo_keyword_faces property to any value (tested with TODO and DONE keywords), opening a org file results in the following error.

Error detected while processing nvim_exec() called at /Users/chris/.local/share/nvim/site/pack/packer/start/orgmode/syntax/org.vim:7:
W18: Invalid character in group name

Steps to reproduce

  1. Add a color override to org_todo_keyword_faces.
  2. Edit an org file
  3. Notice the error in the message area

Note that the color override itself still takes effect.

Expected behavior

No error should occur.

Emacs functionality

n/a

Minimal init.lua

vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvim/site]])

local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'

local function load_plugins()
  require('packer').startup({
    {
      'wbthomason/packer.nvim',
      { 'nvim-treesitter/nvim-treesitter' },
      { 'kristijanhusak/orgmode.nvim', branch = 'master' },
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
    },
  })
end

_G.load_config = function()
  require('orgmode').setup_ts_grammar()
  require('nvim-treesitter.configs').setup({
    highlight = {
      enable = true,
      additional_vim_regex_highlighting = { 'org' },
    },
  })

  vim.cmd([[packadd nvim-treesitter]])
  vim.cmd([[runtime plugin/nvim-treesitter.lua]])
  vim.cmd([[TSUpdateSync org]])

  -- Close packer after install
  if vim.bo.filetype == 'packer' then
    vim.api.nvim_win_close(0, true)
  end

  require('orgmode').setup({
    org_todo_keyword_faces = {
      DONE = ':foreground green'
    }
  })

  -- Reload current file if it's org file to reload tree-sitter
  if vim.bo.filetype == 'org' then
    vim.cmd([[edit!]])
  end
end

if vim.fn.isdirectory(install_path) == 0 then
  vim.fn.system({ 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path })
  load_plugins()
  require('packer').sync()
  vim.cmd([[autocmd User PackerCompileDone ++once lua load_config()]])
else
  load_plugins()
  load_config()
end

Screenshots and recordings

No response

OS / Distro

macOS 12.6

Neovim version/commit

v0.7.2

Additional context

No response

jgollenz commented 2 years ago

I can confirm this. Does neither happen in 0.7.0 nor nightly for me, only on 0.7.2.

bronzehedwick commented 2 years ago

Tried out nightly but I get a different error, so probably a rabbit hole.

jgollenz commented 2 years ago

a different error

please post it regardless :slightly_smiling_face:

cands commented 2 years ago

I can also confirm this issue on nvim 0.7.2.

jgollenz commented 2 years ago

It was introduced by 5b667f4cf6e8e35a35d97a32f699ac1c597a8462

edit: The vim.fn.has('nvim-0.8') check also returns true in 0.7.2 apparently. However, :lua print(vim.fn.has('nvim-0.8')) returns 0.

bronzehedwick commented 2 years ago

Thanks so much @jgollenz !