Skip to content

Instantly share code, notes, and snippets.

@pschyska
Created June 6, 2021 18:38
Show Gist options
  • Save pschyska/af3b627871a7ec65b900ccd8ab67959a to your computer and use it in GitHub Desktop.
Save pschyska/af3b627871a7ec65b900ccd8ab67959a to your computer and use it in GitHub Desktop.
let lfopen = substituteAll {
src = ./files/lfopen;
isExecutable = true;
dir = "bin";
path = makeBinPath [ coreutils lf config.programs.alacritty.package ];
};
#!@shell@
# shellcheck shell=bash
# vim: ft=sh
PATH="@path@:$PATH"
set -e
set -u
set -o pipefail
wd=${1:-$PWD}
temp=$(mktemp -d -t lfopen.XXXXXXXXXX)
cleanup() {
[[ -d $temp ]] && rm -rf "$temp"
}
trap cleanup EXIT
chan="$temp/ch"
mkfifo "$chan"
cat "$chan" &
alacritty --class lf --title "lf: $wd" --working-directory "$wd" \
-e lf -selection-path "$chan"
[ -f "$chan" ] && rm "$chan"
# kill $!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment