diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 459fd76..6bf70b7 100755 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -43,8 +43,7 @@ alias ip='ip --color=auto' # Use lf to switch directories and bind it to ctrl-o lfcd () { tmp="$(mktemp)" - # `command` is needed in case `lfcd` is aliased to `lf` - command lf -last-dir-path="$tmp" "$@" + command lfub -last-dir-path="$tmp" "$@" if [ -f "$tmp" ]; then dir="$(cat "$tmp")" rm -f "$tmp" diff --git a/.local/bin/overrides/lf b/.local/bin/lfub similarity index 74% rename from .local/bin/overrides/lf rename to .local/bin/lfub index 17d4833..1d41cee 100755 --- a/.local/bin/overrides/lf +++ b/.local/bin/lfub @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh # Ueberzugpp script for lf file explorer set -e @@ -13,20 +13,20 @@ esac cleanup() { exec 3>&- - ueberzugpp cmd -s "$UB_SOCKET" -a exit + ueberzug cmd -s "$UB_SOCKET" -a exit } if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then - /usr/bin/lf "$@" + command lf "$@" else [ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf" UB_PID_FILE="$UEBERZUG_TMP_DIR/.$(uuidgen)" - ueberzugpp layer --silent --no-stdin --use-escape-codes --pid-file "$UB_PID_FILE" + ueberzug layer --silent --no-stdin --use-escape-codes --pid-file "$UB_PID_FILE" UB_PID=$(cat "$UB_PID_FILE") rm "$UB_PID_FILE" UB_SOCKET="$UEBERZUG_TMP_DIR/ueberzugpp-${UB_PID}.socket" export UB_PID UB_SOCKET trap cleanup HUP INT QUIT TERM EXIT - /usr/bin/lf "$@" 3>&- + command lf "$@" 3>&- fi