lualine.nvim icon indicating copy to clipboard operation
lualine.nvim copied to clipboard

`branch` supports `oil` now

Open tronikelis opened this issue 1 year ago • 2 comments

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

tronikelis avatar May 20 '24 11:05 tronikelis

Bumping this PR, I would also like these changes.

dtvillafana avatar May 30 '24 19:05 dtvillafana

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

tronikelis avatar May 30 '24 19:05 tronikelis

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 avatar Jul 07 '24 06:07 shadmansaleh

@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

tronikelis avatar Jul 07 '24 07:07 tronikelis

I first thought that I should check the buffer filetype as you can see in this commit

2941f5b (#1242)

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

tronikelis avatar Jul 07 '24 07:07 tronikelis