Created
October 26, 2012 08:41
-
-
Save Paaskehare/3957672 to your computer and use it in GitHub Desktop.
Snippet to unify coloring of filetypes by their extension in bash
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
# Text files | |
LS_TEXT_FILES=(229 txt js py rb c cpp sh conf cfg pl log xml html php cer cfm csr css htm jsp) | |
# Archive files | |
LS_ARCH_FILES=(161 zip 7z Z rar tar.gz tar tar.xz tar.bz2 bz2 gz tbz2 tgz) | |
LS_FILE_EXTS=(LS_TEXT_FILES LS_ARCH_FILES) | |
LS_COLORS="" | |
for e in ${LS_FILE_EXTS[*]}; do | |
eval c=(\${$e[*]}) | |
for ((i=1; i<${#c[@]}; i++)) do | |
LS_COLORS="$LS_COLORS:*.${c[$i]}=38;5;${c[0]}" | |
done | |
done | |
export LS_COLORS="$LS_COLORS:di=38;5;81" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment