-
Notifications
You must be signed in to change notification settings - Fork 88
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
Hide ./ prefix when fd version >= 8.3.0 #211
Conversation
BTW, there are some typos on https://github.com/PatrickF1/fzf.fish/wiki/Thanks 😄 |
Thanks, I was just about to do this myself. Btw, you have my email--feel free to email me the typos and I'll fix them. Sorry about that. |
functions/_fzf_search_directory.fish
Outdated
@@ -7,6 +7,12 @@ function _fzf_search_directory --description "Search the current directory. Repl | |||
# unescape token because it's already quoted so backslashes will mess up the path | |||
set unescaped_exp_token (string unescape -- $expanded_token) | |||
|
|||
# Hide ./ prefix when fd version >= 8.3.0 | |||
# https://github.com/sharkdp/fd/releases/tag/v8.3.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move this up to line 3?
And could you add a todo here that we'll remove this check in a few months and --strip-cwd-prefix
is included in fd's documentation (it's not currently there) and bump up the required fd version to 8.3.0?
Oh, actually could you add a test for when fd is > 8.3 and when it's < 8.3? |
...using the actual program or a mocked fd? Either way it will be too much for this simple check. I don't like tests for the sake of testing. |
Oh a second thought, I kind of like the idea of leaving in the ./ always and instead removing the logic that appends / to the path if it's a directory. Advantages
|
No, it will look ugly with a base directory ( |
You're right--it is pretty ugly. Ok we'll stick with this version! |
In #211, we updated fzf.fish to conditionally pass --strip-cwd-prefix to prevent fd >= 8.3.0 from prepending ./ to the paths sent into fzf. Now that fd 8.3.0 has been out for almost 4 months and most users should have updated to it by now, let's remove this special logic supporting older fd versions to reduce code complexity. This also means the minimum supported version of fd is now 8.3.0.
fd 8.3.0 introduced a
--strip-cwd-prefix
flag to revert a new behavior:./
prefix is shown when output is not a tty (terminal).This is what you get in


_fzf_search_directory
without this patch:And with this patch: