Skip to content

Commit

Permalink
[Search directory] Hide ./ prefix when fd version >= 8.3.0 (#211)
Browse files Browse the repository at this point in the history
fd >= 8.3.0 prefixes ./ to all paths when the output is being piped rather than sent to TTY. This is ugly and we don't need this so we disable this new behavior by passing a new flag --strip-cwd-prefix if the version is >= 8.3.0. Eventually, we will require fd 8.3.0 as a minimum version and always pass that flag.
  • Loading branch information
kidonng authored Dec 1, 2021
1 parent cf25844 commit 6b592e4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions functions/_fzf_search_directory.fish
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
function _fzf_search_directory --description "Search the current directory. Replace the current token with the selected file paths."
set fd_opts --color=always $fzf_fd_opts
if test (fd --version | string replace --regex --all '[^\d]' '') -ge 830
# fd >= 8.3.0 prepends ./ to all paths when output is being piped
# we don't need this so we hide it by passing --strip-cwd-prefix
# Remove this logic March '22 iff fd docs document --strip-cwd-prefix
set --prepend fd_opts --strip-cwd-prefix
end

set fzf_arguments --multi --ansi $fzf_dir_opts
set token (commandline --current-token)
# expand any variables or leading tilde (~) in the token
Expand Down

0 comments on commit 6b592e4

Please sign in to comment.