Skip to content

Instantly share code, notes, and snippets.

@ilyvsc
Last active August 10, 2024 14:52
Show Gist options
  • Save ilyvsc/f18b9400538863e8e583b121003f5382 to your computer and use it in GitHub Desktop.
Save ilyvsc/f18b9400538863e8e583b121003f5382 to your computer and use it in GitHub Desktop.
Preview content inside files using `fzf`
# fzf improvement to preview content from files
function fzf-lovely(){
fzf -m --preview '[[ $(file --mime {}) =~ binary ]] &&
echo {} is a binary file ||
(bat --style=numbers --color=always {} ||
highlight -O ansi -l {} ||
coderay {} ||
rougify {} ||
cat {}) 2> /dev/null | head -500'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment