提问人:Crowbin 提问时间:11/13/2023 更新时间:11/13/2023 访问量:41
neo vim 的配置抛出索引 nil 值错误
config for neo vim is throwing a indexing a nil value error
问:
我做了这个 neo vim 设置,但每当我尝试用它打开 python 文件时,我都会收到这个错误。
这是错误:Error executing vim.schedule lua callback: /Users/~/.config/nvim/lua/core/utils.lua:80: attempt to index a nil value stack traceback: /Users/~/.config/nvim/lua/core/utils.lua:80: in function </Users/~/.config/nvim/lua/core/utils.lua:55>
下面是它引用的函数:
M.load_mappings = function(section, mapping_opt)
vim.schedule(function()
local function set_section_map(section_values)
if section_values.plugin then
return
end
section_values.plugin = nil
for mode, mode_values in pairs(section_values) do
local default_opts = merge_tb("force", { mode = mode }, mapping_opt or {})
for keybind, mapping_info in pairs(mode_values) do
-- merge default + user opts
local opts = merge_tb("force", default_opts, mapping_info.opts or {})
mapping_info.opts, opts.mode = nil, nil
opts.desc = mapping_info[2]
vim.keymap.set(mode, keybind, mapping_info[1], opts)
end
end
end
local mappings = require("core.utils").load_config().mappings
if type(section) == "string" then
mappings[section]["plugin"] = nil
mappings = { mappings[section] }
end
for _, sect in pairs(mappings) do
set_section_map(sect)
end
end)
end
答: 暂无答案
评论