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

chore: add --strip-cwd-prefix to fd #1532

Closed
wants to merge 1 commit into from

Conversation

numToStr
Copy link

@numToStr numToStr commented Dec 2, 2021

I don't know when exactly this prefix (./) started to appear (maybe after fd v0.8.3) but I think this only adds noise to the results. So this PR adds --strip-cwd-prefix flag to remove the prefix.

Before:
image

After:
image


PS: I might need guidance on updating the test :)

@Conni2461
Copy link
Member

This would break some fds for example i just did nix-shell -p fd and the stable version doesnt have a --strip-cwd-prefix.

So yeah

@numToStr
Copy link
Author

numToStr commented Dec 2, 2021

@Conni2461 Ahh, You are right. And indeed this behavior was introduced in v0.8.3 sharkdp/fd#861 so the previous versions won't be affected. We can close this If you want.

@gadkadosh
Copy link

I just spent an hour trying to figure out why this ./ started showing up :)
Along the way I realized rg doesn't return the prefix while find does. So I guess there's already some variance between find_commands.

@Conni2461
Copy link
Member

Okay. I am closing this because we cant really require a minimum fd version. For the future: rg --files doesnt add a ./ so either use that or define your own find_command like this:

telescope.setup {
  defaults = {
    -- ....
  },
  pickers = {
    find_files = {
      find_command = { "fd", "--type", "f", "--strip-cwd-prefix" }
    },
  }
}

I will put this in the wiki. Still thanks for the PR and sharing this option @numToStr :)

@Conni2461 Conni2461 closed this Dec 3, 2021
@numToStr numToStr deleted the fix/prefix branch August 9, 2022 13:09
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.

3 participants