diff options
-rw-r--r-- | .config/lf/lfrc | 43 | ||||
-rw-r--r-- | .config/lf/preview | 48 | ||||
-rw-r--r-- | .config/lf/pv | 9 |
3 files changed, 100 insertions, 0 deletions
diff --git a/.config/lf/lfrc b/.config/lf/lfrc new file mode 100644 index 0000000..05ec490 --- /dev/null +++ b/.config/lf/lfrc @@ -0,0 +1,43 @@ +# Basic Settings +set previewer ~/.config/lf/pv #preview +set preview true +# set drawbox true +# set icons true +set ignorecase true +set scrolloff 1 +set shell zsh + +# unmap keys +map y +map d + +# keybindings +# rename +map C rename # at the end +map c push C<a-b><a-b><a-f> +map <c-c> push C<c-u> # new rename + +map yy copy +map dd cut +map H set hidden! + + + +# custom commands + +cmd mkdir ${{ + echo "Directory Name: " + read ans + mkdir $ans +}} + +# cmd copyto ${{ +# clear; tput cup $(($(tput lines)/3)); tput bold +# set -f +# clear; echo "Copy to where?" +# dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|' )" && +# for x in $fx; do +# eval cp -ivr \"$x\" \"$dest\" +# done && +# notify-send "📋 File(s) copied." "File(s) copies to $dest." +# }} diff --git a/.config/lf/preview b/.config/lf/preview new file mode 100644 index 0000000..c90dba6 --- /dev/null +++ b/.config/lf/preview @@ -0,0 +1,48 @@ +#!/bin/sh +# thank you brodie robertson for this + +# Clear the last preview (if any) +$HOME/.config/lf/image clear + +# Calculate where the image should be placed on the screen. +num=$(printf "%0.f\n" "`echo "$(tput cols) / 2" | bc`") +numb=$(printf "%0.f\n" "`echo "$(tput cols) - $num - 1" | bc`") +numc=$(printf "%0.f\n" "`echo "$(tput lines) - 2" | bc`") + +case "$1" in + *.tgz|*.tar.gz) tar tzf "$1";; + *.tar.bz2|*.tbz2) tar tjf "$1";; + *.tar.txz|*.txz) xz --list "$1";; + *.tar) tar tf "$1";; + *.zip|*.jar|*.war|*.ear|*.oxt) unzip -l "$1";; + *.rar) unrar l "$1";; + *.7z) 7z l "$1";; + *.[1-8]) man "$1" | col -b ;; + *.o) nm "$1" | less ;; + *.torrent) transmission-show "$1";; + *.iso) iso-info --no-header -l "$1";; + *odt,*.ods,*.odp,*.sxw) odt2txt "$1";; + *.doc) catdoc "$1" ;; + *.docx) docx2txt "$1" - ;; + *.csv) cat "$1" | sed s/,/\\n/g ;; + *.pdf) + CACHE=$(mktemp /tmp/thumbcache.XXXXX) + pdftoppm -png -f 1 -singlefile "$1" "$CACHE" + $HOME/.config/lf/image draw "$CACHE.png" $num 1 $numb $numc + ;; + *.epub) + CACHE=$(mktemp /tmp/thumbcache.XXXXX) + epub-thumbnailer "$1" "$CACHE" 1024 + $HOME/.config/lf/image draw "$CACHE" $num 1 $numb $numc + ;; + *.bmp|*.jpg|*.jpeg|*.png|*.xpm) + $HOME/.config/lf/image draw "$1" $num 1 $numb $numc + ;; + *.wav|*.mp3|*.flac|*.m4a|*.wma|*.ape|*.ac3|*.og[agx]|*.spx|*.opus|*.as[fx]|*.flac) exiftool "$1";; + *.avi|*.mp4|*.wmv|*.dat|*.3gp|*.ogv|*.mkv|*.mpg|*.mpeg|*.vob|*.fl[icv]|*.m2v|*.mov|*.webm|*.ts|*.mts|*.m4v|*.r[am]|*.qt|*.divx) + CACHE=$(mktemp /tmp/thumbcache.XXXXX) + ffmpegthumbnailer -i "$1" -o "$CACHE" -s 0 + $HOME/.config/lf/image draw "$CACHE" $num 1 $numb $numc + ;; + *) highlight --out-format ansi "$1" || cat "$1";; +esac diff --git a/.config/lf/pv b/.config/lf/pv new file mode 100644 index 0000000..9330eed --- /dev/null +++ b/.config/lf/pv @@ -0,0 +1,9 @@ +#!bin/sh +case "$1" in + *.tar*) tar tf "$1";; + *.zip) unzip -l "$1";; + *.rar) unrar l "$1";; + *.7z) 7z l "$1";; + *.pdf) pdftotext "$1" -;; + *) highlight -O ansi "$1";; +esac |