NvChad / nvcommunity

NvChad community repo for sharing plugin configurations
GNU General Public License v3.0
85 stars 14 forks source link

Attempt to index a nil value in community mappings #11

Closed BrunoKrugel closed 11 months ago

BrunoKrugel commented 1 year ago

After some commit mappings in community are receiving and nil index error and the mappings are not working

Error executing vim.schedule lua callback: /Users/bruno.krugel/.config/nvim/lua/core/utils.lua:80: attempt to index a nil value
stack traceback:
        /Users/user.name/.config/nvim/lua/core/utils.lua:80: in function </Users/user.name/.config/nvim/lua/core/utils.lua:55>

Example of mapping:

---@type NvPluginSpec
local spec = {
  "nvim-telescope/telescope.nvim",
  dependencies = { "debugloop/telescope-undo.nvim" },
  init = function()
    require("core.mappings").undo = {
      plugin = true,
      n = {
        ["<leader>fu"] = { "<CMD>Telescope undo<CR>", "Find undo" },
      },
    }
    require("telescope").load_extension "undo"
    require("core.utils").load_mappings "undo"
  end,
}

return spec

For 3.0, change require("core.mappings").undo to require("nvconfig").mappings.undo fix the error and the mappings.

Creating the issue for tracking purposes.

BrunoKrugel commented 1 year ago

Example of importing:

  { "NvChad/nvcommunity" },
  { import = "nvcommunity.editor.telescope-undo"},