summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2019-01-13 14:20:19 +0200
committerDylan Araps <dylan.araps@gmail.com>2019-01-13 14:20:19 +0200
commit1f125d4bcc98d25817ec9402246cc1e5429e90e7 (patch)
tree983fd674e9e2fca5a7350d8530e18dc6a47b25dc
parent5e528dd53376990de56a0e5af04595e1f8a35056 (diff)
support for LS_COLORS
-rwxr-xr-xfff8
1 files changed, 7 insertions, 1 deletions
diff --git a/fff b/fff
index 63721fc..bea8b95 100755
--- a/fff
+++ b/fff
@@ -71,10 +71,15 @@ get_cursor_pos() {
}
get_ls_colors() {
+ # Parse the LS_COLORS variable and source each file type
+ # as a separate variable.
+ # Format: :*.ext=0;0:*.jpg=0;0;0:
ls_cols="${LS_COLORS//\*./file_}"
ls_cols="${ls_cols//=/=\'}"
ls_cols="${ls_cols//:/\';}"
- source <(printf '%s' "$ls_cols")
+
+ # bash 3 compatible method of sourcing a variable.
+ source /dev/stdin <<< "$ls_cols"
}
status_line() {
@@ -611,6 +616,7 @@ main() {
((BASH_VERSINFO[0] > 3)) &&
read_flags=(-t 0.05)
+ # Initialize LS_COLORS support if enabled.
((${FFF_LS_COLORS:=1} == 1)) &&
get_ls_colors