dotfiles

Yes, my $HOME has a git repo now :(

git clone git://git.shimmy1996.com/dotfiles.git
commit e4be5d098a1d6f19dc824ed5e1cded3519824d58
parent 1fad5cc2c2c4921396d5f7e18c0d29e98daf73f9
Author: Shimmy Xu <shimmy.xu@shimmy1996.com>
Date:   Thu, 24 Jan 2019 23:39:21 -0500

Add image preview in lf using catimg.

Diffstat:
M.config/lf/lfrc | 7+++++++
M.gitignore | 1+
A.local/bin/lf/previewer | 11+++++++++++
3 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/.config/lf/lfrc b/.config/lf/lfrc
@@ -20,6 +20,9 @@ set ifs "\n"
 # leave some space at the top and the bottom of the screen
 set scrolloff 10
 
+# enable ANSI 256 color escape code support
+set color256 on
+
 # use enter for shell commands
 map <enter> shell
 
@@ -109,3 +112,7 @@ cmd zip ${{
     zip -r $1.zip $1
     rm -rf $1
 }}
+
+# preview command
+set previewer ~/.config/lf/pv.sh
+map i $~/.local/bin/lf/previewer $f | less -R
diff --git a/.gitignore b/.gitignore
@@ -54,6 +54,7 @@
 !.local/bin
 !.local/bin/*
 !.local/bin/i3blocks/*
+!.local/bin/lf/*
 !.local/bin/sway/*
 !.local/share
 !.local/share/applications
diff --git a/.local/bin/lf/previewer b/.local/bin/lf/previewer
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+case "$1" in
+    *.png|*.jpg|*.jpeg) catimg -r 2 -w 110 -t "$1";;
+    *.tar*) tar tf "$1";;
+    *.zip) unzip -l "$1";;
+    *.rar) unrar l "$1";;
+    *.7z) 7z l "$1";;
+    *.pdf) pdftotext "$1" -;;
+    *) highlight -O ansi "$1" || cat "$1";;
+esac