Last active
July 9, 2019 08:41
-
-
Save tamphh/b21ce548d244abea1bbbdc4a76fb353c to your computer and use it in GitHub Desktop.
Bash script to preview files with bat for 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
#!/bin/bash | |
file="$1" | |
[[ $(file --mime "$file") =~ binary ]] && | |
echo "$file" is a binary file || | |
(bat --style=numbers --color=always "$file" || | |
highlight -O ansi -l "$file" || | |
coderay "$file" || | |
rougify "$file" || | |
cat "$file") 2> /dev/null | head -500 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment