Closed sf8193 closed 1 year ago
First of all: great plugin! I have been searching for something like this but did not find it! At least for me, much better than a sidebar TOC. And it works very well with Latex and the texlab LSP.
I have a similar problem as described above using lazy.vim.
This works (even without changing anything with the on attach function):
return {
"SmiteshP/nvim-navbuddy",
dependencies = {
"neovim/nvim-lspconfig",
"SmiteshP/nvim-navic",
"MunifTanjim/nui.nvim",
},
-- keys = {
-- { "<leader>nv", "<cmd>Navbuddy<cr>", desc = "Nav" },
-- },
config = function()
local navbuddy = require("nvim-navbuddy")
navbuddy.setup({
lsp = { auto_attach = true, preference = { "nvim_lsp", "nvim-cmp", "nvim-lspconfig", "texlab", "lua_ls" } },
})
end,
}
But when I want to set the keybinding with:
return {
"SmiteshP/nvim-navbuddy",
dependencies = {
"neovim/nvim-lspconfig",
"SmiteshP/nvim-navic",
"MunifTanjim/nui.nvim",
},
keys = {
{ "<leader>nv", "<cmd>Navbuddy<cr>", desc = "Nav" },
},
config = function()
local navbuddy = require("nvim-navbuddy")
navbuddy.setup({
lsp = { auto_attach = true, preference = { "nvim_lsp", "nvim-cmp", "nvim-lspconfig", "texlab", "lua_ls" } },
})
end,
}
I get the error that the Navbuddy
is not an editor command.
Hi Guys! @sf8193 @pascalsiemsen
I haven't yet explored how Lazy.nvim works or stuff. But this seems like something to do with lazy loading the plugin I guess. Looking at both the examples looks like some issue with lazy loading. Can you both try by explicitly asking lazy.nvim to not "lazy load" nvim-navbuddy. (Briefly skimming through the readme I think it can be done via this lazy = false
, but you guys do check)
If nvim-navbuddy is loading fine when not lazy loaded, then this might be issue with Lazy.nvim.
Still I will soon try to migrate my config from packer to lazy, will try to figure out then.
Removing the lazy loading works! Thanks for the hint. I'll try to look into it and figure out if it could be fixed another way.
Also thanks for the plugin! It's adorable.
Looks like when you define it as a dependencies
it will work fine!
Hi guys! @pascalsiemsen @sf8193 I hope the solution pointed out by @Jxstxs works for you guys. Can you confirm?
i think actually my issue was slightly different than the above. Mine works fine as long as i'm not using autoAttach
, so i don't believe it's an issue with lazy loading (as mine wasn't being loaded lazily with config=true
). having said that i just reverted to manually attaching during lspAttach with event='LspAttach
and it worked well
I can confirm that lazy=false
works.
Thanks a lot
with these configs
using lazy, i get an error saying nav buddy doesn't exist. When I add
to my on attach function, it works fine.