rebelot / heirline.nvim

Heirline.nvim is a no-nonsense Neovim Statusline plugin designed around recursive inheritance to be exceptionally fast and versatile.
MIT License
1.02k stars 40 forks source link

Issue with Navic #118

Closed unphased closed 1 year ago

unphased commented 1 year ago

I used most of the snippets from the cookbook, in the order they were presented, and I probably have a too new version of navic I'm guessing? Need help debugging:

E5108: Error executing lua ...local/share/nvim/lazy/nvim-navic/lua/nvim-navic/init.lua:439: bad argument #3 to '__index' (string expected, got table)
stack traceback:
        [C]: in function '__index'
        ...local/share/nvim/lazy/nvim-navic/lua/nvim-navic/init.lua:439: in function 'condition'
        ...hare/nvim/lazy/heirline.nvim/lua/heirline/statusline.lua:284: in function '_eval'
        ...hare/nvim/lazy/heirline.nvim/lua/heirline/statusline.lua:365: in function '_eval'
        ...hare/nvim/lazy/heirline.nvim/lua/heirline/statusline.lua:365: in function '_eval'
        ...hare/nvim/lazy/heirline.nvim/lua/heirline/statusline.lua:365: in function '_eval'
        ...hare/nvim/lazy/heirline.nvim/lua/heirline/statusline.lua:440: in function 'eval'
        ...ocal/share/nvim/lazy/heirline.nvim/lua/heirline/init.lua:89: in function <...ocal/share/nvim/lazy/heirline.nvim/lua/heirline/init.lua:84>

Let me know if details are needed.

The other bit of info I have now is that simply not including the Navic bar component resolves the error so it's not caused by the navic code. I slightly suspect simply calling setup on navic before running heirline config might do the trick. Will test that now.

sidzwans commented 1 year ago

Are you using the Full nerd one? Try to change the condition variable to:

condition = function() return require("nvim-navic").is_available() end,

unphased commented 1 year ago

Is there a full nerd cookbook somewhere? haha. The cookbook is very huge. But quite informative. Definitely getting the hang of how to customize this thing now! Yes, it is where I got the snippet that I was trying to use from. I'm not aware of other sources of heirline templates/starter configs aside from that one and this one: https://github.com/anuvyklack/dotfiles/blob/main/roles/neovim/files/lua/anuvyklack/heirline/init.lua

I'll try that modification out for navic and report back. Kinda still debating whether I even want to use navic or just stick to context breadcrumbs served by treesitter, and also debating whether it should go in the winbar or statusbar. But heirline makes it easy. Probably leaning towards sticking this stuff in the winbar.

sidzwans commented 1 year ago

The Heirline's cookbook is good enough. Follow one at a time and try to make sense of the codes.