`branch` supports `oil` now
Hey, so when using oil file manager the branch is empty when viewing an oil buffer, this is because oil has its own path, now this is a small change to make it work, but I don't really like modifying globally the component like this, maybe this project should have some hooks or apis that the user could override, like get_buffer_dir ?
The same problem is with filename component and the fix is the same to use the oil api get_current_dir, so thats why I think having a global user editable api for directories would be a great option
https://github.com/nvim-lualine/lualine.nvim/issues/1077
https://github.com/nvim-lualine/lualine.nvim/issues/1077#issuecomment-2119754614
Bumping this PR, I would also like these changes.
If anyone wants these changes already, I created a separate plugin that patches the lualine components and exports them https://github.com/Tronikelis/lualine-components.nvim
If I understand correctly with this enabled branch component shows git branch based on which directory you have opened in oil right?
This effects all buffere not just the oil buffer? or is it just on the window where oil is opened?
@shadmansaleh
If I understand correctly with this enabled branch component shows git branch based on which directory you have opened in oil right?
yes
This effects all buffere not just the oil buffer?
It affects all buffers, this is fine because get_current_dir returns empty string if current buffer is not oil so we just check for that
I first thought that I should check the buffer filetype as you can see in this commit
But I ran into some issues where I presume lualine updates before oil sets the buffer type or something like that and that code just did not work, but I am very new to nvim/lua in general so it could be a skil issue