nikvdp / neomux

Control Neovim from shells running inside Neovim.
MIT License
350 stars 11 forks source link

Error using neomux with lualine #10

Closed prg318 closed 3 years ago

prg318 commented 3 years ago

When I have both neomux and lualine in my neovim (built from latest git)'s plug configuration, I get the following error when starting neovim:

E15: Invalid expression: v:lua.require'lualine'.statusline()∥ W:[%{WindowNumber()}]

Could this be related to https://github.com/nikvdp/neomux/issues/5 ?

Neomux still works, but the lualine status is not displayed.

nikvdp commented 3 years ago

Hey @prg318, thanks for the feedback! I don't use lualine myself, but I took a look and it seems lualine doesn't like something about the way neomux adds its window numbers to the statusbar.

I've added a quick guard to have neomux not attempt to update the statusbar if lualine is present, which fixes that message and allows lualine to load successfully.

To get neomux window numbers to show up in lualine you can then do something like the following in your require('lualine').setup() stanza:

sections = {                                                                                                 
    lualine_z = { function() return vim.api.nvim_exec([[echo "| W: " . WindowNumber() . " |"]], true) end }  
},                                                                                                           
inactive_sections = {                                                                                        
    lualine_z = { function() return vim.api.nvim_exec([[echo "| W: " . WindowNumber() . " |"]], true) end }  
}                                                                                                            

Let me know if that solves it for you!

prg318 commented 3 years ago

Yup! That works for me. Thanks! Much appreciated