b0o / incline.nvim

🎈 Floating statuslines for Neovim, winbar alternative
MIT License
759 stars 14 forks source link

No module called incline.helpers #65

Open Samthesurf opened 5 months ago

Samthesurf commented 5 months ago

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

b0o commented 5 months ago

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?

Samthesurf commented 5 months ago

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,
}
b0o commented 5 months ago

Hi, I edited your comment to format the code.

To fix this, remove this line: version = "*",. Then update your plugins using lazy.nvim and restart neovim.

This will tell lazy.nvim to install the latest commit of Incline, rather than the latest release (which is quite old).

Samthesurf commented 5 months ago

Hi, I edited your comment to format the code.

To fix this, remove this line: version = "*",. Then update your plugins using lazy.nvim and restart neovim.

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.

b0o commented 5 months ago

It works for me with that config, make sure you have an LSP attached and treesitter enabled.

2024-03-27_16-24-12_region

Samthesurf commented 5 months ago

Yes I have both enabled, if you look below, you can see the lsps attached. Terminal_screen.png