summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.config/lf/lfrc11
-rw-r--r--.config/shell/aliasrc1
-rwxr-xr-x.local/bin/lf-cleaner4
-rwxr-xr-x.local/bin/lfub24
4 files changed, 37 insertions, 3 deletions
diff --git a/.config/lf/lfrc b/.config/lf/lfrc
index f87325d..3ea7f58 100644
--- a/.config/lf/lfrc
+++ b/.config/lf/lfrc
@@ -8,6 +8,8 @@ set scrolloff 10
set icons
set period 1
set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml"
+set ratios 1:2:3
+set cleaner ~/.local/bin/lf-cleaner
# Vars that depend on environmental variables
$lf -remote "send $id set previewer ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope"
@@ -15,8 +17,9 @@ $lf -remote "send $id set previewer ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope"
# cmds/functions
cmd open ${{
case $(file --mime-type "$(readlink -f $f)" -b) in
+ application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;;
image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;;
- text/*) $EDITOR $fx;;
+ text/*|application/json|inode/x-empty) $EDITOR $fx;;
image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;;
image/svg+xml) display -- $f ;;
image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" | setsid -f sxiv -aio 2>/dev/null | lf-select & ;;
@@ -94,8 +97,8 @@ map O $mimeopen --ask $f
map A rename # at the very end
map c push A<c-u> # new rename
map I push A<c-a> # at the very beginning
-map i push A<a-b><a-b><a-f> # before extension
-map a push A<a-b> # after extension
+map i push A<a-b><a-b><a-f> # before extention
+map a push A<a-b> # after extention
map B bulkrename
map b $setbg $f
@@ -105,5 +108,7 @@ map V push :!nvim<space>
map W $setsid -f $TERMINAL >/dev/null 2>&1
+map Y $printf "%s" "$fx" | xclip -selection clipboard
+
# Source Bookmarks
source "~/.config/lf/shortcutrc"
diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc
index ad71695..502f79f 100644
--- a/.config/shell/aliasrc
+++ b/.config/shell/aliasrc
@@ -45,6 +45,7 @@ alias \
z="zathura"
alias \
+ lf="lfub" \
magit="nvim -c MagitOnly" \
ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" \
weath="less -S ${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" \
diff --git a/.local/bin/lf-cleaner b/.local/bin/lf-cleaner
new file mode 100755
index 0000000..a184d84
--- /dev/null
+++ b/.local/bin/lf-cleaner
@@ -0,0 +1,4 @@
+#!/bin/sh
+if [ -n "$FIFO_UEBERZUG" ]; then
+ printf '{"action": "remove", "identifier": "PREVIEW"}\n' > "$FIFO_UEBERZUG"
+fi
diff --git a/.local/bin/lfub b/.local/bin/lfub
new file mode 100755
index 0000000..2cf470a
--- /dev/null
+++ b/.local/bin/lfub
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# This is a wrapper script for lb that allows it to create image previews with
+# ueberzug. This works in concert with the lf configuration file and the
+# lf-cleaner script.
+
+set -e
+
+cleanup() {
+ exec 3>&-
+ rm "$FIFO_UEBERZUG"
+}
+
+if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
+ lf "$@"
+else
+ [ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf"
+ export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$"
+ mkfifo "$FIFO_UEBERZUG"
+ ueberzug layer -s <"$FIFO_UEBERZUG" -p json &
+ exec 3>"$FIFO_UEBERZUG"
+ trap cleanup EXIT
+ lf "$@" 3>&-
+fi