diff options
Diffstat (limited to 'mut')
| -rwxr-xr-x | mut/bin/lfub | 12 | ||||
| -rwxr-xr-x | mut/lf/cleaner | 2 | ||||
| -rw-r--r-- | mut/lf/lfrc | 4 | ||||
| -rwxr-xr-x[-rw-r--r--] | mut/lf/scope | 6 | ||||
| -rw-r--r-- | mut/neovim/fnl/conf/events.fnl | 8 |
5 files changed, 17 insertions, 15 deletions
diff --git a/mut/bin/lfub b/mut/bin/lfub index d04a129..894ffde 100755 --- a/mut/bin/lfub +++ b/mut/bin/lfub @@ -11,14 +11,4 @@ cleanup() { 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 HUP INT QUIT TERM EXIT - lf "$@" 3>&- -fi +lf "$@" diff --git a/mut/lf/cleaner b/mut/lf/cleaner new file mode 100755 index 0000000..1b18195 --- /dev/null +++ b/mut/lf/cleaner @@ -0,0 +1,2 @@ +#!/bin/sh +exec kitten icat --clear --stdin no --transfer-mode file < /dev/null > /dev/tty diff --git a/mut/lf/lfrc b/mut/lf/lfrc index cca28fd..7887ef5 100644 --- a/mut/lf/lfrc +++ b/mut/lf/lfrc @@ -27,7 +27,8 @@ set previewer '~/.config/lf/scope' set autoquit true cmd z %{{ - result="$(zoxide query --exclude "${PWD}" -- "$0")" + echo "$1" > ~/lflogs + result="$(zoxide query --exclude "${PWD}" -- "$1")" lf -remote "send ${id} cd '${result}'" }} map z push :z<space> @@ -137,6 +138,7 @@ cmd bulkrename ${{ }} # Bindings +map . $$EDITOR ${PWD} map <c-f> $lf -remote "send $id select \"$(fzf)\"" map J $lf -remote "send $id cd $(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)" map gh diff --git a/mut/lf/scope b/mut/lf/scope index 8265a87..5571d42 100644..100755 --- a/mut/lf/scope +++ b/mut/lf/scope @@ -6,8 +6,8 @@ set -C -f IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}" image() { - if [ -f "$1" ] && [ -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" + if [ -f "$1" ] && command -V kitten >/dev/null 2>&1; then + kitten icat --transfer-mode file --stdin no --place "${2}x${3}@${4}x${5}" "$1" < /dev/null > /dev/tty else mediainfo "$6" fi @@ -31,7 +31,7 @@ image/svg+xml) image "$CACHE.png" "$2" "$3" "$4" "$5" "$1" ;; image/*) image "$1" "$2" "$3" "$4" "$5" "$1" ;; - text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;; + text/html) open "$1" ;; text/troff) man ./ "$1" | col -b ;; text/* | */xml | application/json | application/x-ndjson) bat -p --theme ansi --terminal-width "$(($4-2))" -f "$1" ;; audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; diff --git a/mut/neovim/fnl/conf/events.fnl b/mut/neovim/fnl/conf/events.fnl index 4e03df8..dcc73a2 100644 --- a/mut/neovim/fnl/conf/events.fnl +++ b/mut/neovim/fnl/conf/events.fnl @@ -63,6 +63,14 @@ (lint.try_lint) (vim.schedule #(vim.diagnostic.setloclist {:open false})))}) +(event + [:BufEnter] + {:group "conf#events" + :callback + #(do (var dir (vim.fn.fnamemodify (vim.fn.expand "%") ":h")) + (if (vim.startswith dir "oil://") (set dir (dir:sub (+ 1 (length "oil://"))))) + (vim.cmd (.. "silent !lf -remote \"send cd '" dir "'\"")))}) + (local session-file (.. vim.env.HOME "/.vimsession.vim")) (event |
