diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2022-03-15 12:20:16 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2022-03-15 12:20:16 +0100 |
commit | 1c7f5f233957d9ff1fde064d6fd76ef59e8dc0f5 (patch) | |
tree | f9a1ceeac5310cc8296d6414b65107e993fa2598 /.config/lf | |
parent | upadte (diff) | |
download | dotfiles-bsd-1c7f5f233957d9ff1fde064d6fd76ef59e8dc0f5.tar.gz dotfiles-bsd-1c7f5f233957d9ff1fde064d6fd76ef59e8dc0f5.tar.bz2 dotfiles-bsd-1c7f5f233957d9ff1fde064d6fd76ef59e8dc0f5.tar.xz dotfiles-bsd-1c7f5f233957d9ff1fde064d6fd76ef59e8dc0f5.tar.zst dotfiles-bsd-1c7f5f233957d9ff1fde064d6fd76ef59e8dc0f5.zip |
Good for now
Diffstat (limited to '')
-rw-r--r-- | .config/lf/lfrc | 4 | ||||
-rwxr-xr-x | .config/lf/scope | 38 |
2 files changed, 41 insertions, 1 deletions
diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 50930ba..8c7ddcd 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -2,6 +2,7 @@ set shellopts '-eu' set ifs "\n" set scrolloff 10 +set shell "/usr/local/bin/dash" set icons set period 1 set previewer '~/.config/lf/scope' @@ -30,7 +31,7 @@ cmd open ${{ esac }} -cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')" +cmd mkdir $mkdir -p "$(gecho $* | tr ' ' '\ ')" cmd bulkrename $vidir $fx map gr cd / @@ -47,6 +48,7 @@ map <enter> open map D delete map W $$SHELL map S $$SHELL +map <c-s> $$SHELL map <c-n> push :mkdir<space> map <f-7> push :mkdir<space> map <c-r> reload diff --git a/.config/lf/scope b/.config/lf/scope new file mode 100755 index 0000000..3bc2f9c --- /dev/null +++ b/.config/lf/scope @@ -0,0 +1,38 @@ +#!/bin/sh + +# File preview handler for lf. + +set -C -f +# IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}" + +# image() { +# if [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1; then +# printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$4" "$5" "$(($2-1))" "$(($3-1))" "$1" > "$FIFO_UEBERZUG" +# else +# mediainfo "$1" +# fi +# } + +# ifub() { +# [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1 +# } + +# Note that the cache file name is a function of file information, meaning if +# an image appears in multiple places across the machine, it will not have to +# be regenerated once seen. + +case "$(file --dereference --brief --mime-type -- "$1")" in + image/*) mediainfo "$1" || exit 1 ;; + text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;; + text/troff) man ./ "$1" | col -b ;; + text/* | */xml | application/json) bat --plain --terminal-width "$4" -f "$1" ;; + application/zip) atool --list -- "$1" ;; + application/x-xz) atool --list -- "$1" ;; + application/gzip) atool --list -- "$1" ;; + audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; + video/* ) mediainfo "$1" || exit 1 ;; + */pdf) pdftotext "$1" - || exit 1 ;; + *opendocument*) odt2txt "$1" || exit 1;; + application/pgp-encrypted) gpg -d -- "$1" ;; +esac +exit 1 |