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

branch supports oil now #1242

Merged
merged 4 commits into from
Jul 8, 2024
Merged

Conversation

Tronikelis
Copy link
Contributor

@Tronikelis Tronikelis commented May 20, 2024

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

#1077

#1077 (comment)

@dtvillafana
Copy link

Bumping this PR, I would also like these changes.

@Tronikelis
Copy link
Contributor Author

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

@shadmansaleh
Copy link
Member

shadmansaleh commented Jul 7, 2024

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?

@Tronikelis
Copy link
Contributor Author

@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
Copy link
Contributor Author

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

@shadmansaleh shadmansaleh merged commit ff3fedb into nvim-lualine:master Jul 8, 2024
5 checks passed
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 this pull request may close these issues.

None yet

3 participants