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

feature: git worktrees picker #1646

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

Atan-D-RP4
Copy link

@Atan-D-RP4 Atan-D-RP4 commented Dec 26, 2024

A simple git worktrees picker that uses 'ThePrimeagen/git-worktree.nvim' plugin to create, delete and switch to git worktrees.

It would be better to implement this completely with fzf-lua's own utilities instead of relying on an external plugin like the rest of the git pickers.

But this is more of a proof of concept or proposal kind of thing. Since I don't know if having this is something that goes along with fzf-lua's feature set and design philosophy. So for now, it remains basic and fragile with room for improvement.

Not to mention that I haven't made any updates to the docs for this and that passing any options to this will likely break it.

@ibhagwan
Copy link
Owner

Tysm @Atan-D-RP4 for the contribution.

But this is more of a proof of concept or proposal kind of thing. Since I don't know if having this is something that goes along with fzf-lua's feature set and design philosophy. So for now, it remains basic and fragile with room for improvement.

The only issue I have with this is that the picker relies on ThePrimeagen/git-worktree.nvim, I strongly feel that in this case the responsibility on creating the picker is at the other plugin’s end and I wouldn’t want to make this exception here nor deal with I can’t switch a work tree not having written the code.

This has been the paradigm for a while now, if a plugin has a picker than most of them give an option for fuzzy fishing by supporting Telescope, fzf-lua, etc. For example, dressing.nvim, neoclip, Mason’s ctrl-f, etc.

I feel the above is a better practice in this case.

@Atan-D-RP4
Copy link
Author

Atan-D-RP4 commented Dec 26, 2024 via email

@Atan-D-RP4 Atan-D-RP4 changed the title git worktrees picker (feat) git worktrees picker Dec 26, 2024
@Atan-D-RP4 Atan-D-RP4 changed the title (feat) git worktrees picker feature: git worktrees picker Dec 26, 2024
@ibhagwan
Copy link
Owner

Well yeah, I said as much in my PR. This is my first Open-Source
contribution, like, ever and I'm also new to the codebase and Neovim in
general, so I wanted to prove to myself that I can build something like
this that works at present and not be dismissed out of hand.

This is a great contribution regardless!

I wanted to do it completely with fzf-lua's own utilities that are
available for this at first but like I said, I'm new to all of this and
found it too difficult to understand both the code from
ThePrimeagen/git-worktree.nvim and fzf-lua's own for this(which is not
nearly as straightforward as telescope's but also it is so much more
integrated and cool and wow is that cool but also so difficult to follow
down) to implement the picker that way.

Fzf-lua has to use some “tricks” since it’s not all contained in lua on the neovim main thread, you’re interacting with an external process via named pipe most of the time.

Thank you as well, @ibhagwan/fzf-lua, for all of your amazing work on
this project, and your time reviewing my PR and responding here.

Ty for your kind words and interest in the project @Atan-D-RP4 :)

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.

2 participants