Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickF1 committed Apr 16, 2021
1 parent 18bc775 commit b8579d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion functions/__fzf_preview_file.fish
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# helper function for __fzf_search_current_dir
function __fzf_preview_file --argument-names file_path --description "Print a preview for the given file based on its file type."
function __fzf_preview_file --description "Print a preview for the given file based on its file type."
# because there appears to guarantee that __fzf_search_current_dir passes the path to __fzf_preview_file
# as one argument, we collect all the arguments into one single variable
set file_path $argv

if test -f "$file_path" # regular file
bat --style=numbers --color=always "$file_path"
else if test -d "$file_path" # directory
Expand Down
2 changes: 1 addition & 1 deletion functions/__fzf_search_current_dir.fish
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function __fzf_search_current_dir --description "Search the current directory. R
if string match --quiet -- "*/" $token && test -d "$unescaped_exp_token"
set --append fd_opts --base-directory=$unescaped_exp_token
# use the directory name as fzf's prompt to indicate the search is limited to that directory
set --prepend fzf_arguments --prompt="$unescaped_exp_token" --preview="__fzf_preview_file $expanded_token'{}'"
set --prepend fzf_arguments --prompt="$unescaped_exp_token" --preview="__fzf_preview_file $expanded_token{}"
set file_paths_selected $unescaped_exp_token(fd $fd_opts 2>/dev/null | fzf $fzf_arguments)
else
set --prepend fzf_arguments --query="$unescaped_exp_token" --preview='__fzf_preview_file {}'
Expand Down

0 comments on commit b8579d9

Please sign in to comment.