-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No module called incline.helpers #65
Comments
Are you using lazy.nvim as your plugin manager? Can you share the config you used to add incline as a plugin? Also, can you try updating your plugins? |
Yes I am using lazy as my package manager. This is the config I used: return {
"b0o/incline.nvim",
name = "incline",
version = "*",
dependencies = { "SmiteshP/nvim-navic", "nvim-tree/nvim-web-devicons" },
config = function()
local helpers = require("incline.helpers")
local navic = require("nvim-navic")
local devicons = require("nvim-web-devicons")
require("incline").setup({
window = {
padding = 0,
margin = { horizontal = 0, vertical = 0 },
},
render = function(props)
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
if filename == "" then
filename = "[No Name]"
end
local ft_icon, ft_color = devicons.get_icon_color(filename)
local modified = vim.bo[props.buf].modified
local res = {
ft_icon and { " ", ft_icon, " ", guibg = ft_color, guifg = helpers.contrast_color(ft_color) } or "",
" ",
{ filename, gui = modified and "bold,italic" or "bold" },
guibg = "#44406e",
}
if props.focused then
for _, item in ipairs(navic.get_data(props.buf) or {}) do
table.insert(res, {
{ " > ", group = "NavicSeparator" },
{ item.icon, group = "NavicIcons" .. item.type },
{ item.name, group = "NavicText" },
})
end
end
table.insert(res, " ")
return res
end,
})
end,
} |
Hi, I edited your comment to format the code. To fix this, remove this line: This will tell lazy.nvim to install the latest commit of Incline, rather than the latest release (which is quite old). |
It's working now but it just has the default look, it doesn't have the Nvim Navic look that was advertised. |
@Samthesurf If you are still having this issue, initially it was not working for me either. Then I realized that navic has to be included in the local navic = require("nvim-navic")
require("lspconfig").clangd.setup {
on_attach = function(client, bufnr)
navic.attach(client, bufnr)
end
} Alternative, looking at how barbecue.nvim plugin does it, you can create an autocmd for this as well: vim.api.nvim_create_autocmd("LspAttach", {
desc = "Navic Attacher",
group = vim.api.nvim_create_augroup("navic-attacher", {}),
callback = function(a)
local client = vim.lsp.get_client_by_id(a.data.client_id)
if client and client.server_capabilities["documentSymbolProvider"] then
navic.attach(client, a.buf)
end
end,
}) I'm using the second option and it's working for me with this config: return {
"b0o/incline.nvim",
event = "BufReadPre",
dependencies = { "SmiteshP/nvim-navic", "nvim-tree/nvim-web-devicons" },
keys = {
{ "<leader>I", '<Cmd>lua require"incline".toggle()<Cr>', desc = "Incline: Toggle" },
},
config = function()
local helpers = require("incline.helpers")
local devicons = require("nvim-web-devicons")
local navic = require("nvim-navic")
vim.api.nvim_create_autocmd("LspAttach", {
desc = "Navic Attacher",
group = vim.api.nvim_create_augroup("idr4n/navic-attacher", {}),
callback = function(a)
local client = vim.lsp.get_client_by_id(a.data.client_id)
if client and client.server_capabilities["documentSymbolProvider"] then
navic.attach(client, a.buf)
end
end,
})
require("incline").setup({
render = function(props)
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
if filename == "" then
filename = "[No Name]"
end
local ft_icon, ft_color = devicons.get_icon_color(filename)
local modified = vim.bo[props.buf].modified
local res = {
ft_icon and { " ", ft_icon, " ", guibg = ft_color, guifg = helpers.contrast_color(ft_color) } or "",
" ",
{ filename, gui = modified and "bold,italic" or "bold" },
guibg = "#44406e",
}
if props.focused then
for _, item in ipairs(navic.get_data(props.buf) or {}) do
table.insert(res, {
{ " > ", group = "NavicSeparator" },
{ item.icon, group = "NavicIcons" .. item.type },
{ item.name, group = "NavicText" },
})
end
end
table.insert(res, " ")
return res
end,
})
end,
} |
I copied one of the configs (the one involving nvim-navic and it tells me that incline.helpers doesn't exist and I don't understand why? I am on Neovim nightly
The text was updated successfully, but these errors were encountered: