5

My OS is Arch Linux, the edition of Lua is 5.4.4 I'm trying to configure the neovim pluging, nvim-tree. And my configuration Lua file are as follow.

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"
    }
})

When opening neovim, there is an error message said that:

Error detected while processing ~/.config/nvim/init.lua:
E5113: Error while calling lua chunk:
~/.config/nvim/lua/plugin-config/nvim-tree.lua:10: attempt to call field 'setup' (a nil value)
stack traceback:
~/.config/nvim/lua/plugin-config/nvim-tree.lua:10: in main chunk
[C]: in function 'require'
~/.config/nvim/init.lua:10: in main chunk

But the nvim-tree can be used normally.

I had try to fixed it by changing the file into the way which described in the https://github.com/kyazdani42/nvim-tree.lua

require'nvim-tree'.setup { }

but it led to more error, because I used the

require("plugin-config.nvim-tree")

in the init.lua, the will have conflict.
So how can I fix this problem?

romainl
  • 186,200
  • 21
  • 280
  • 313
wuliJerry
  • 101
  • 1
  • 2
  • 5

1 Answers1

5

I got a similar error with that plugin. So I leave a trivial tip. Although I found you are better trained than me on the vim. Just in case.

Try this.

:checkhealth

It answered me the plugin needs upper version like 0.7.0 and that was correct in my case. I didn't even need the 'neovim NIGHTLY'.

DharmanBot
  • 1,066
  • 2
  • 6
  • 10