summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Vink <59492084+ivi-vink@users.noreply.github.com>2025-01-31 19:22:06 +0000
committerMike Vink <59492084+ivi-vink@users.noreply.github.com>2025-01-31 19:25:16 +0000
commita5851e9b6de58305436a9aaf5c0f66fcb54232b8 (patch)
tree811bc0bbc6ffe10cb7e33bea42abb0ee84535e5c
parenta18029250a4744749debd6ea0a39c4a53cbe820c (diff)
use lf config
-rw-r--r--justfile1
-rw-r--r--mut/lf/icons77
-rw-r--r--mut/lf/lfrc57
-rw-r--r--profiles/core/lf.nix81
4 files changed, 115 insertions, 101 deletions
diff --git a/justfile b/justfile
index b4408e2..dd5694f 100644
--- a/justfile
+++ b/justfile
@@ -74,6 +74,7 @@ NIXNAME := "vm-aarch64"
! [ -d ~/.config/k9s ] && ln -sf /nix-config/mut/k9s ~/.config/k9s
! [ -d ~/.config/carapace ] && ln -sf /nix-config/mut/carapace ~/.config/carapace
! [ -d ~/.config/git ] && ln -sf /nix-config/mut/git ~/.config/git
+ ! [ -d ~/.config/lf ] && ln -sf /nix-config/mut/lf ~/.config/lf
! [ -d ~/.config/nushell ] && ln -sf /nix-config/mut/nushell ~/.config/nushell
! [ -d ~/.config/vis ] && ln -sf /nix-config/mut/vis ~/.config/vis
diff --git a/mut/lf/icons b/mut/lf/icons
new file mode 100644
index 0000000..aad068c
--- /dev/null
+++ b/mut/lf/icons
@@ -0,0 +1,77 @@
+di 📁
+fi 📃
+tw 🤝
+ow 📂
+ln ⛓
+or ❌
+ex 🎯
+*.txt ✍
+*.mom ✍
+*.me ✍
+*.ms ✍
+*.avif 🖼
+*.png 🖼
+*.webp 🖼
+*.ico 🖼
+*.jpg 📸
+*.jpe 📸
+*.jpeg 📸
+*.gif 🖼
+*.svg 🗺
+*.tif 🖼
+*.tiff 🖼
+*.xcf 🖌
+*.html 🌎
+*.xml 📰
+*.gpg 🔒
+*.css 🎨
+*.pdf 📚
+*.djvu 📚
+*.epub 📚
+*.csv 📓
+*.xlsx 📓
+*.tex 📜
+*.md 📘
+*.r 📊
+*.R 📊
+*.rmd 📊
+*.Rmd 📊
+*.m 📊
+*.mp3 🎵
+*.opus 🎵
+*.ogg 🎵
+*.m4a 🎵
+*.flac 🎼
+*.wav 🎼
+*.mkv 🎥
+*.mp4 🎥
+*.webm 🎥
+*.mpeg 🎥
+*.avi 🎥
+*.mov 🎥
+*.mpg 🎥
+*.wmv 🎥
+*.m4b 🎥
+*.flv 🎥
+*.zip 📦
+*.rar 📦
+*.7z 📦
+*.tar 📦
+*.z64 🎮
+*.v64 🎮
+*.n64 🎮
+*.gba 🎮
+*.nes 🎮
+*.gdi 🎮
+*.1 ℹ
+*.nfo ℹ
+*.info ℹ
+*.log 📙
+*.iso 📀
+*.img 📀
+*.bib 🎓
+*.ged 👪
+*.part 💔
+*.torrent 🔽
+*.jar ♨
+*.java ♨
diff --git a/mut/lf/lfrc b/mut/lf/lfrc
index 7047e2d..e34d8c3 100644
--- a/mut/lf/lfrc
+++ b/mut/lf/lfrc
@@ -28,34 +28,33 @@ set autoquit true
set relativenumber
cmd z %{{
- echo "$1" > ~/lflogs
- result="$(zoxide query --exclude "${PWD}" -- "$1")"
+ result="$(zoxide query --exclude "${PWD}" -- "$@")"
lf -remote "send ${id} cd '${result}'"
}}
map z push :z<space>
# 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/*|application/json|inode/x-empty|application/x-subrip) $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\|avif\|tif\|ico\)\(_large\)*$" |
- setsid -f nsxiv -aio 2>/dev/null | while read -r file; do
- [ -z "$file" ] && continue
- lf -remote "send select \"$file\""
- lf -remote "send toggle"
- done &
- ;;
- audio/*|video/x-ms-asf) mpv --audio-display=no $f ;;
- video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
- application/pdf|application/vnd.djvu|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
- application/pgp-encrypted) $EDITOR $fx ;;
- application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.formula|application/vnd.oasis.opendocument.database) setsid -f libreoffice $fx >/dev/null 2>&1 ;;
- *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;;
- esac
+# 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/*|application/json|inode/x-empty|application/x-subrip) $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\|avif\|tif\|ico\)\(_large\)*$" |
+# setsid -f nsxiv -aio 2>/dev/null | while read -r file; do
+# [ -z "$file" ] && continue
+# lf -remote "send select \"$file\""
+# lf -remote "send toggle"
+# done &
+# ;;
+# audio/*|video/x-ms-asf) mpv --audio-display=no $f ;;
+# video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
+# application/pdf|application/vnd.djvu|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
+# application/pgp-encrypted) $EDITOR $fx ;;
+# application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.formula|application/vnd.oasis.opendocument.database) setsid -f libreoffice $fx >/dev/null 2>&1 ;;
+# *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;;
+# esac
}}
cmd mkdir $mkdir -p "$@"
@@ -138,7 +137,21 @@ cmd bulkrename ${{
lf -remote "send $id unselect"
}}
+cmd on-quit ${{
+ if [ -e /tmp/lf-on-quit ]; then
+ cat /tmp/lf-on-quit
+ rm /tmp/lf-on-quit
+ else
+ echo $OLDPWD
+ fi
+}}
+
+cmd change-last-dir &{{
+ echo "$PWD" > /tmp/lf-on-quit
+}}
+
# Bindings
+map ~ change-last-dir
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)"
diff --git a/profiles/core/lf.nix b/profiles/core/lf.nix
index ab7d686..752e8b3 100644
--- a/profiles/core/lf.nix
+++ b/profiles/core/lf.nix
@@ -4,84 +4,7 @@
# "lf/cleaner".source = config.lib.meta.mkMutableSymlink /mut/lf/cleaner;
# "lf/scope".source = config.lib.meta.mkMutableSymlink /mut/lf/scope;
# "lf/lfrc".source = config.lib.meta.mkMutableSymlink /mut/lf/lfrc;
- "lf/icons".text = ''
- di 📁
- fi 📃
- tw 🤝
- ow 📂
- ln ⛓
- or ❌
- ex 🎯
- *.txt ✍
- *.mom ✍
- *.me ✍
- *.ms ✍
- *.avif 🖼
- *.png 🖼
- *.webp 🖼
- *.ico 🖼
- *.jpg 📸
- *.jpe 📸
- *.jpeg 📸
- *.gif 🖼
- *.svg 🗺
- *.tif 🖼
- *.tiff 🖼
- *.xcf 🖌
- *.html 🌎
- *.xml 📰
- *.gpg 🔒
- *.css 🎨
- *.pdf 📚
- *.djvu 📚
- *.epub 📚
- *.csv 📓
- *.xlsx 📓
- *.tex 📜
- *.md 📘
- *.r 📊
- *.R 📊
- *.rmd 📊
- *.Rmd 📊
- *.m 📊
- *.mp3 🎵
- *.opus 🎵
- *.ogg 🎵
- *.m4a 🎵
- *.flac 🎼
- *.wav 🎼
- *.mkv 🎥
- *.mp4 🎥
- *.webm 🎥
- *.mpeg 🎥
- *.avi 🎥
- *.mov 🎥
- *.mpg 🎥
- *.wmv 🎥
- *.m4b 🎥
- *.flv 🎥
- *.zip 📦
- *.rar 📦
- *.7z 📦
- *.tar 📦
- *.z64 🎮
- *.v64 🎮
- *.n64 🎮
- *.gba 🎮
- *.nes 🎮
- *.gdi 🎮
- *.1 ℹ
- *.nfo ℹ
- *.info ℹ
- *.log 📙
- *.iso 📀
- *.img 📀
- *.bib 🎓
- *.ged 👪
- *.part 💔
- *.torrent 🔽
- *.jar ♨
- *.java ♨
- '';
+ #"lf/icons".text = ''
+ #'';
};
}