NvChad / starter

Starter config for NvChad
The Unlicense
133 stars 468 forks source link

Set NvChad Theme Error #36

Closed Pro100v closed 3 months ago

Pro100v commented 3 months ago

After installation and download all plugins on attempting to change theme over <leader> + th at moment to change selected theme gets error:

E5108: Error executing lua: .../share/nvim/lazy/ui/lua/telescope/_extensions/themes.lua:68: attempt to index field 'ui' (a n il value)

related source file:

      ------------ save theme to chadrc on enter ----------------
      actions.select_default:replace(function()
        if action_state.get_selected_entry() then
          local chadrc = dofile(vim.fn.stdpath "config" .. "/lua/chadrc.lua")

          local old_theme = chadrc.ui.theme or chadrc.base46.theme
          old_theme = 'theme = "' .. old_theme .. '"'

          local theme = 'theme = "' .. action_state.get_selected_entry()[1] .. '"'

          require("nvchad.utils").replace_word(old_theme, theme)
          actions.close(prompt_bufnr)
        end
      end)

error on line: local old_theme = chadrc.ui.theme or chadrc.base46.theme

lua/chadrc.lua:

---@type ChadrcConfig
local M = {}

M.base46 = {
    theme = "onedark",

    -- hl_override = {
    --  Comment = { italic = true },
    --  ["@comment"] = { italic = true },
    -- },
}

return M

in this file ui is not defined.

Workarraund is to append to lua/chadrc.lua empty table M.ui = {} Not schure what fix is correct - it's my first expereance to meet nvim and first day to meet NvChard.

siduck commented 3 months ago

run lazy sync