Last active
August 10, 2024 14:52
-
-
Save ilyvsc/f18b9400538863e8e583b121003f5382 to your computer and use it in GitHub Desktop.
Preview content inside files using `fzf`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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