I am trying to setup nvim-tree in my neovim plugins. I am using the Lazy package manager and I am using someone elses config as a guide on github.
In my Lazy options, I have netrw
in teh disabled_plugins
section and I am importing my plugins
directory which contains the nvim-tree
plugin, but my neovim is still using netrw and not nvim-tree. I'm not getting any error messages or anything so I'm not really sure what I'm doing wrong.
Here are some of the files that I think are relevant to this problem:
This is nvim/lua/moorby/lazy.lua
:
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
local opts = {
defaults = {
lazy = true,
},
install = {
colorscheme = { "monokai" }
},
rtp = {
disabled_plugins = {
"gzip",
"matchit",
"matchparen",
"netrw",
"netrwplugin",
"tarplugin",
"tohtml",
"tutor",
"zipplugin",
}
},
change_detection = {
enabled = true,
notify = true,
},
}
require("lazy").setup(
{
{import = "moorby.plugins"}
},
opts
)
nvim/lua/moorby/plugins/nvim-tree.lua
return {
"nvim-tree/nvim-tree.lua",
filters = {
dotfiles = true,
},
lazy = false
}
nvim/lua/moorby/plugins/colorscheme.lua
(my colorscheme is loading fine by the way)
return {
"tanvirtin/monokai.nvim",
lazy = false,
priority = 999,
config = {},
}
In this screenshot, you can see netrw in the background and you can see that nvim-tree has been successfully loaded by Lazy:
EDIT: I just noticed that the plugin being imported is nvim-tree.LUA
not nvim-tree.NVIM
but I tried to change this and it does not work so I think .lua
is still correct and that is definitely the URL of the repo.
In your configuration, you need to call setup
function for the nvim-tree.lua
plugin and you could also disable netrw
in init.lua
=> see "Setup" section in https://github.com/nvim-tree/nvim-tree.lua
-- disable netrw at the very start of your init.lua
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
nvim/lua/moorby/plugins/nvim-tree.lua
:
return {
"nvim-tree/nvim-tree.lua",
config = function()
require("nvim-tree").setup({
filters = {
dotfiles = true,
},
lazy = false
})
end,
}