我的操作系统是Arch Linux,Lua的版本是5.4.4 我正在尝试配置neovim插件,nvim-tree。我的配置Lua文件如下。
local status, nvim_tree = pcall(require, "nvim-tree")
if not status then
vim.notify("can't find nvim-tree")
return
end
local list_keys = require('keybindings').nvimTreeList
nvim_tree.setup ({
auto_close = true,
git = {
enable = false
},
update_cwd = true,
update_focused_file = {
enable = true,
update_cwd = true
},
filters = {
dotfiles = true,
custom = {"node_modules"}
},
view = {
width = 30,
side = "left",
hide_root_folder = false,
auto_resize = true,
mappings = {
custom_only = false,
list = list_keys
},
number = false,
relativenumber = false,
signcolumn = "yes"
}
})
Run Code Online (Sandbox Code Playgroud)
打开neovim时,出现一条错误消息:
处理 ~/.config/nvim/init.lua 时检测到错误:
E5113:调用 lua 块时出错:
~/.config/nvim/lua/plugin-config/nvim-tree.lua:10:尝试调用字段“setup” ' (零值)
堆栈回溯:
~/.config/nvim/lua/plugin-config/nvim-tree.lua:10: 在主块中
[C]: 在函数 'require' 中
~/.config/nvim/init .lua:10:在主块中
但nvim-tree可以正常使用。
我尝试通过将文件更改为https://github.com/kyazdani42/nvim-tree.lua中描述的方式来修复它
require'nvim-tree'.setup { }
Run Code Online (Sandbox Code Playgroud)
但这导致了更多错误,因为我使用了
require("plugin-config.nvim-tree")
Run Code Online (Sandbox Code Playgroud)
在init.lua中,会产生冲突。
那么我该如何解决这个问题呢?
小智 7
我使用该插件时遇到了类似的错误。所以我留下一个小提示。虽然我发现你对 vim 的训练比我好。万一。
尝试这个。
:checkhealth
Run Code Online (Sandbox Code Playgroud)
它回答我插件需要像 0.7.0 这样的更高版本,这对我来说是正确的。我什至不需要“neovim NIGHTLY”。