scottmckendry / cyberdream.nvim

🤖💤 High-contrast, Futuristic & Vibrant Coloursheme for Neovim
MIT License
732 stars 30 forks source link

bug: Error while calling lua chunk #106

Closed idelice closed 3 months ago

idelice commented 3 months ago

Description

   Error  14:27:08 notify.error lazy.nvim Failed to run `config` for cyberdream.nvim

vim/_editor.lua:0: /Users/delice/.config/nvim/init.lua..nvim_exec2() called at /Users/delice/.config/nvim/init.lua:0../Users/delice/.local/share/nvim/lazy/cyberdream.nvim/colors/cyberdream.lua: Vim(colorscheme):E5113: Error while calling lua chunk: .../share/nvim/lazy/cyberdream.nvim/lua/cyberdream/util.lua:20: invalid key: style
stack traceback:
    [C]: in function 'nvim_set_hl'
    .../share/nvim/lazy/cyberdream.nvim/lua/cyberdream/util.lua:20: in function 'syntax'
    .../share/nvim/lazy/cyberdream.nvim/lua/cyberdream/util.lua:35: in function 'load'
    .../share/nvim/lazy/cyberdream.nvim/lua/cyberdream/init.lua:12: in function 'load'
    ...al/share/nvim/lazy/cyberdream.nvim/colors/cyberdream.lua:1: in main chunk
    [C]: in function 'nvim_exec2'
    vim/_editor.lua: in function 'cmd'
    /Users/delice/.config/nvim/lua/plugins/cyberdream.lua:26: in function 'config'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:376: in function <...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:374>
    [C]: in function 'xpcall'
    .../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:135: in function 'try'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:391: in function 'config'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:358: in function '_load'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:197: in function 'load'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:127: in function 'startup'
    ...elice/.local/share/nvim/lazy/lazy.nvim/lua/lazy/init.lua:112: in function 'setup'
    /Users/delice/.config/nvim/lua/config/lazy.lua:9: in main chunk
    [C]: in function 'require'
    /Users/delice/.config/nvim/init.lua:2: in main chunk

# stacktrace:
  - vim/_editor.lua:0 _in_ **cmd**
  - ~/.config/nvim/lua/plugins/cyberdream.lua:26 _in_ **config**
  - ~/.config/nvim/lua/config/lazy.lua:9
  - ~/.config/nvim/init.lua:2

Neovim version?

0.10.0

What should happen?

No error when opening nvim

What happened instead?

Error

Your configuration

return {
  "scottmckendry/cyberdream.nvim",
  lazy = false,
  priority = 1000,
  config = function()
    require("cyberdream").setup({
      -- Recommended - see "Configuring" below for more config options
      transparent = true,
      italic_comments = true,
      hide_fillchars = true,
      borderless_telescope = false,
      terminal_colors = true,
      theme = {
        -- variant = "light",
        highlights = {
          CursorLineNr = { fg = "#ff9e64", style = "bold" },
          MiniFilesBorder = { fg = "#ff9e64" },
          -- Type = { fg = "NONE", bg = "NONE" },
          -- Keyword = { fg = "NONE", bg = "NONE" },
          TelescopeBorder = { fg = "#ff9e64" },
          -- IndentLineCurrent = { fg = "#7b8496" },
          -- MiniIndentscopeSymbol = { fg = "#7b8496" },
        },
      },
    })
    vim.cmd("colorscheme cyberdream") -- set the colorscheme

    vim.api.nvim_create_autocmd("BufEnter", {
      pattern = "*.java",
      callback = function()
        -- Disable some syntax highlighting for Java files
        -- print("Jave files detected. Disabling syntax highlighting for Java files.")
        vim.api.nvim_command("highlight Keyword guifg=NONE")
        vim.api.nvim_command("highlight Type guifg=NONE")
      end,
    })

    vim.api.nvim_create_autocmd("BufEnter", {
      pattern = { "*.tsx", "*.ts", "*.js", "*.jsx" },
      callback = function()
        -- Re-enable syntax highlighting for non-Java files.
        -- print("Re-enabling syntax highlighting for TypeScript and JavaScript files.")
        vim.api.nvim_command("highlight link Keyword Number")
        vim.api.nvim_command("highlight link Type Operator")
      end,
    })
  end,
}
scottmckendry commented 3 months ago

Hello @idelice ,

If you change CursorLineNr = { fg = "#ff9e64", style = "bold" } to CursorLineNr = { fg = "#ff9e64", bold = true } it should resolve the error.

The reason is because style isn't a valid option when calling vim.api.nvim_set_hl.

Up until 3.7.0, these were being converted into valid options during setup. I'd converted all the instances within the plugin before removing that code, but I hadn't considered anyone would have them in their own overrides. Sorry about that!

idelice commented 3 months ago

Hello @idelice ,

If you change CursorLineNr = { fg = "#ff9e64", style = "bold" } to CursorLineNr = { fg = "#ff9e64", bold = true } it should resolve the error.

The reason is because style isn't a valid option when calling vim.api.nvim_set_hl.

Up until 3.7.0, these were being converted into valid options during setup. I'd converted all the instances within the plugin before removing that code, but I hadn't considered anyone would have them in their own overrides. Sorry about that!

Thank you. That fixed it!