From d14bb821b86f560e7da56cce8c686d3e09aa0785 Mon Sep 17 00:00:00 2001 From: Shubham Saini Date: Tue, 26 Sep 2023 15:12:26 -0700 Subject: lf: nixified --- darwin/home.nix | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/darwin/home.nix b/darwin/home.nix index 5ae2bd0..626d4b9 100644 --- a/darwin/home.nix +++ b/darwin/home.nix @@ -77,4 +77,41 @@ signByDefault = true; }; }; + programs.lf = { + enable = true; + settings = { + shell = "sh"; + icons = true; + drawbox = true; + scrolloff = 10; + shellopts = "-eu"; + }; + commands = { + extract = '' + %{{ + set -f + case $f in + *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;; + *.tar.gz|*.tgz) tar xzvf $f;; + *.tar.xz|*.txz) tar xJvf $f;; + *.zip) unzip $f;; + *.rar) unrar x $f;; + *.7z) 7z x $f;; + esac + }} + ''; + open = '' + %{{ + case $(file --mime-type -Lb $f) in + text/*) lf -remote "send $id \$$EDITOR \$fx";; + *) for f in $fx; do $OPENER $f > /dev/null 2> /dev/null & done;; + esac + }} + ''; + }; + keybindings = { + "" = "shell"; + "." = "set hidden!"; + }; + }; } -- cgit v1.2.3