Closed illegitimate-egg closed 1 year ago
Please go through the documentation for examples. you need to make use of the get_location
(or get_data
) function in your statusline or winbar.
I added the example lualine config to my init.lua
but it still doesn't do anything
local navic = require("nvim-navic")
require("lspconfig").clangd.setup {
on_attach = function(client, bufnr)
navic.attach(client, bufnr)
end
}
-- Set lualine as statusline
-- See `:help lualine.txt`
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'onedark',
component_separators = '|',
section_separators = {left = '', right = ''},
sections = {
lualine_c = {
{ navic.get_location, cond = navic.is_available },
}
}
},
}
Is clangd working? Check with :LspInfo
Looks like it is
Can you run this command to please :lua vim.pretty_print(require("nvim-navic").is_available())
I responds with false
Wait a minute 🤔 If you set up lualine with this function
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'onedark',
component_separators = '|',
section_separators = {left = '', right = ''},
sections = {
lualine_c = {
{ navic.get_location, cond = navic.is_available },
}
}
},
}
You are only defining section_c ... so the statusline should only have navic data on statusline.. But in your screenshot there is lots of stuff going on in the statusline.
Did you restart your neovim instance?
yea
I am pretty sure its something to do with your config or something, and nothing wrong in nvim-navic 🤔
Can you try creating a minimal config with only bare minimum stuff for nvim-navic to work. So that would be just lsp-config, nvim-navic and lualine. And setup lsp server first, then setup lualine.
Or even easier for you, you could just try using my neovim config from my Dotfiles by copy pasting it your config path.
that probably would be easier
impatient.lua doesn't exist
Make sure to change this line though https://github.com/SmiteshP/Dotfiles/blob/master/.config/nvim/lua/config/packer.lua#L35
Change to "SmiteshP/nvim-navic",
Yeah, you may need to restart the nvim instance a once or twice, packer installs stuff and treesitter and mason do their thing as well.
It works here
Yep, so its definitely some issue in the config that you wrote.
damn
Yep, that's how it is sometimes 😆 🫂 Do try starting with minimal setup if all else fails
Now my normal init.lua doesn't load
Why do you think your one works and mine doesn't (not init.lua, nvim-navic)
Try cleaning ~/.local/share/nvim
oh, I guess I should have made it more clear, I got my config working again
I was talking about your plugin
Not really sure buddy, must be something silly probably. Will have to take close look. I don't have my laptop with me right now. So can't do much rn.
Alright, you've already done more than I expected you to so thanks
welcome
Just checking, have you found anything wrong with it yet?
I got it to work, my lsp config was defined differently
When I install the plugin and attach it to the lsp nothing happens.
init.lua
: