Just starting to learn Neovim and I m struggling with something that might be a simple to fix for someone experienced.
Using LazyVim distribution for Neovim which internally use Lazy.nvim
as plugin manager and uses neo-tree as one of the plugins.
I want to configure neo-tree plugin to show relative line numbers in its file explorer.
Using this and this as referance, I made a new file in plugins/neo-tree.lua
with this as contents:
return {
{
"nvim-neo-tree/neo-tree.nvim",
opts = {
view = {
relativenumber = true,
},
},
},
}
Now after this, when I restart, I should see line number but I don't. What could go wrong here?
Note: When I m in the neo-tree buffer and i set number
, I see line numbers.
There is no relativenumber
option for the nvim-neo-tree/neo-tree.nvim
plugin. You are confusing with the nvim-tree/nvim-tree.lua
plugin (discussion about this option).
For the neo-tree.nvim
plugin, you could enable relativenumber with Lazy via event_handlers
:
return {
"nvim-neo-tree/neo-tree.nvim",
opts = {
event_handlers = {
event = "neo_tree_buffer_enter",
handler = function()
vim.opt_local.relativenumber = true
end,
},
},
}