diff options
author | Dylan Araps <dylan.araps@gmail.com> | 2019-01-13 23:48:30 +0200 |
---|---|---|
committer | Dylan Araps <dylan.araps@gmail.com> | 2019-01-13 23:48:30 +0200 |
commit | 8b40d63cdb87364fde266fca576e9506b315595b (patch) | |
tree | 00fd224c6dc17a5e0cd026a91bc23880fcda81f7 | |
parent | 60d123f5d20a4737b78a081bad1f1a264eb79107 (diff) |
ls_colors: full working support
-rwxr-xr-x | fff | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -205,7 +205,9 @@ print_line() { # Color files that end in a pattern as defined in LS_COLORS. # 'BASH_REMATCH' is an array that stores each REGEX match. - elif [[ $ls_patterns && $file_name =~ ($ls_patterns)$ ]]; then + elif [[ $FFF_LS_COLORS == 1 && + $ls_patterns && + $file_name =~ ($ls_patterns)$ ]]; then match="${BASH_REMATCH[0]}" file_ext="ls_${match//[^a-zA-Z0-9=\\;]/_}" format+="\\e[${!file_ext:-${fi:-37}}m" @@ -213,7 +215,8 @@ print_line() { # Color files based on file extension and LS_COLORS. # Check if file extension adheres to POSIX naming # stardard before checking if it's a variable. - elif [[ $file_ext != "$file_name" && + elif [[ $FFF_LS_COLORS == 1 && + $file_ext != "$file_name" && $file_ext =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]]; then file_ext="ls_${file_ext}" format+="\\e[${!file_ext:-${fi:-37}}m" |