Skip to content

Enable file preview for some file types #3276

Answered by faxotherapy
faxotherapy asked this question in Q&A
Discussion options

You must be logged in to vote

I solved my problem as follows:

  1. Create a function:
    pale() { [[ $(file --mime "$1") =~ text ]] && CLICOLOR_FORCE=1 COLORTERM=truecolor glow -p -w 100 -s $HOME/.config/glow/dark_h1_bg_color.json "$1" || { [[ -d "$1" ]] && eza -1 --icons -TL 2 {}; } }
  2. Rewrite fzf option:
    --preview 'zsh -c $(functions pale); pale {}'
    For Bash user, read this.

Inspired by this post.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by faxotherapy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant