nvim-lualine/lualine.nvim

Bug: Not detecting branch on files in subdirectories

Jlchong3 opened this issue · 4 comments

The lualine detects the branch I am in when I use a file in the same directory as the .git, but when going to a file in a subdirectory lualine stops showing the branch I am in, is that supposed to happen?

Here it is with a file in the same directory as .git
image

When entering a file in a subdirectory
image

Use ":e path/to/your/file" or use telescope plugin to find file can solve this problem.

Came across this today, To add a few more details:

  • Looks like the bug only triggers when opening a file from my file tree plugin (neo-tree.nvim) which is not in the same directory as .git
    • This appears to be the same plugin as in the screenshot
  • Opening a file in same directory as .git through file tree plugin shows the branch
  • Opening any file through telescope or :e foo shows the branch

My initial reaction is that this may be caused by how neo-tree opens files, since I don't get the same issue with telescope - but I don't have any evidence to back up that claim.

Edit: fixed wording

I just stumbled across a Neo-tree issue that seems to be the cause of this issue. Linking to it here so both issues have visibility on each other: nvim-neo-tree/neo-tree.nvim#1264

This looks like it would be a Windows-specific problem from Neo-tree, and @Jlchong3 from your path separator it seems you are on Windows as well. I also verified, I'm not getting this git branch problem on WSL with the exact same config when opening from Neo-tree.

I believe this issue is fixed by the latest PR mentioned above in neo-tree.nvim. If you want to double check you can pull the plugin with lazy using:

{
    "nvim-neo-tree/neo-tree.nvim",
    branch = "main".
    -- ...
}