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

fzf integration as an alternative to telescope - closes #701 #702

Closed
wants to merge 3 commits into from

Conversation

ornicar
Copy link

@ornicar ornicar commented Dec 14, 2024

It seems to work. This is the most lua I have ever written, so it's probably all sorts of wrong.

For #701

image

@ornicar ornicar changed the title fzf integration as an alternative to telescope fzf integration as an alternative to telescope - closes #701 Dec 14, 2024
@ornicar ornicar mentioned this pull request Dec 14, 2024
@ornicar ornicar force-pushed the fzf-alternative-to-telescope branch from ec3089c to b916d66 Compare December 15, 2024 09:51
@ckipp01
Copy link
Member

ckipp01 commented Dec 15, 2024

lThanks for sending this in @ornicar! However, I wonder if it's even needed. A while back I added the commands() function that you can use with

require("metals").commands()

which will actually give you all of the commands metals knows about (minus the ones that are nvim-metals specific). A quick glance at the fzf-lua docs show me register_ui_select which will make vim.ui.select use fzf-lua and the commands() function is handled by whatever you have registered for vim.ui.select. What you have probably is a bit superior since it includes the extra couple commands for nvim-metals, but I still wanted to point it out. I don't have an issue merging this in this, especially if it's useful for those extra commands.

@ornicar
Copy link
Author

ornicar commented Dec 15, 2024

You're right! I overlooked that. I'll close the PR then, let's not add unnecessary code.

It was a good learning experience for me nonetheless 👍

@ornicar ornicar closed this Dec 15, 2024
Copy link
Member

@ckipp01 ckipp01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ornicar !

:lua require("metals").fzf_menu()
<

NOTE: If you'd rather utilize |vim.ui.select| for this, a more generic
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh I see what I wrote before you probably know since you touched this.

end

return function(opts)
opts = opts or {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see one looking through the docs, but I wish there was a way to also include the description that would be shown but not considered when you search. Either way, maybe an improvement for later on if someone knows how to add that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only way I see is through a preview, as the fzf-lua menu entries are simple strings.

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