Skip to content

Commit

Permalink
[Search directory] fix preview when base dir contains spaces (patch 3)
Browse files Browse the repository at this point in the history
There is still a bug afflicting the search directory feature. To reproduce, set -x fzf_preview_dir_cmd ls and search with a base directory with spaces in its name. The fix is to quote the entire command passed to eval
  • Loading branch information
kidonng authored May 15, 2021
1 parent 2b52633 commit b59f1cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions functions/__fzf_preview_file.fish
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ function __fzf_preview_file --description "Print a preview for the given file ba
else if test -f "$file_path" # regular file
if set --query fzf_preview_file_cmd
# need to escape quotes to make sure eval receives file_path as a single arg
eval $fzf_preview_file_cmd \"$file_path\"
eval "$fzf_preview_file_cmd '$file_path'"
else
bat --style=numbers --color=always "$file_path"
end
else if test -d "$file_path" # directory
if set --query fzf_preview_dir_cmd
# see above
eval $fzf_preview_dir_cmd \"$file_path\"
eval "$fzf_preview_dir_cmd '$file_path'"
else
# -A list hidden files as well, except for . and ..
# -F helps classify files by appending symbols after the file name
Expand Down

0 comments on commit b59f1cf

Please sign in to comment.