Skip to content
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

lualine.nvim errors when calling setup in init.lua #536

Open
playa4l opened this issue Sep 15, 2024 · 2 comments · May be fixed by nvim-lualine/lualine.nvim#1300
Open

lualine.nvim errors when calling setup in init.lua #536

playa4l opened this issue Sep 15, 2024 · 2 comments · May be fixed by nvim-lualine/lualine.nvim#1300

Comments

@playa4l
Copy link

playa4l commented Sep 15, 2024

Expected behavior

Lualine is loaded.

Current behavior

Lualine throws an error , doesn't load and the rest of the Neovim files are sourced properly.

Reproducing

  1. Make sure you installed luarocks for your distro.

  2. Get the first init.lua from my Neovim settings.

  3. Open Neovim then run :Rocks! install lualine.nvim | q.

  4. Subsitute the last line (require('init')) with require('lualine').setup({}).

  5. Reopen Neovim.

  6. Open Neovim again.

Additional info

I visited the Lualine GH repo and followed the steps to make an issue, including the part involving making an isolated Neovim settings and, after testing, I reached the conclusion the problem is within rocks.nvim, since the actual setup works as intended in the isolated environment.

@mrcjkb
Copy link
Member

mrcjkb commented Sep 16, 2024

Hey 👋

Thanks for reporting 🙏

@mrcjkb mrcjkb transferred this issue from nvim-neorocks/rocks.nvim Sep 16, 2024
@mrcjkb mrcjkb changed the title Lualine doesn't loads lualine.nvim doesn't load Sep 16, 2024
@mrcjkb mrcjkb transferred this issue from nvim-neorocks/nurr Sep 16, 2024
@mrcjkb mrcjkb changed the title lualine.nvim doesn't load lualine.nvim errors when calling setup in init.lua Sep 16, 2024
@mrcjkb
Copy link
Member

mrcjkb commented Sep 16, 2024

Result of my investigation:

This is because lualine uses vim.api.nvim_get_runtime_file instead of package.searchpath to search for its themes, which are in the lua directory.
This works if the package is installed with a flat hierarchy (which is how most plugin managers install plugins), but not if it is installed as a luarocks package.

I will look into PRing a fix to lualine.nvim.

In the meantime, there are these workarounds:

  • Call lualine.setup() in a plugin script, e.g. ~/.nvim/plugin/lualine.lua
  • Use rocks-config.nvim to configure lualine
  • Use rocks-git.nvim to install lualine.nvim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants