From 201de14519dad64437199451af91d5245da7295e Mon Sep 17 00:00:00 2001 From: Andre Ramnitz Date: Sun, 25 Oct 2026 09:06:33 +0100 Subject: [PATCH] lf: update config, add rulerfile --- dot-config/lf/lfrc | 42 +++++++++++++++++------------------------ dot-config/lf/rulerfile | 21 +++++++++++++++++++++ 2 files changed, 38 insertions(+), 25 deletions(-) create mode 100644 dot-config/lf/rulerfile diff --git a/dot-config/lf/lfrc b/dot-config/lf/lfrc index 76ae424..c41d69b 100644 --- a/dot-config/lf/lfrc +++ b/dot-config/lf/lfrc @@ -14,10 +14,7 @@ set number true set relativenumber false set mergeindicators true set preload true - - -# options -set rulerfmt '%i/%t (%P)' +set rulerfile ~/.config/lf/rulerfile # previews via https://github.com/NikitaIvanovV/ctpv?tab=readme-ov-file set sixel true @@ -75,24 +72,18 @@ on-focus-gained map trash # map delete -cmd add-dir ${{ - printf "Directory name:" - read ans - mkdir $ans -}} - -cmd add-file ${{ - printf "File name:" - read ans - touch $ans +cmd mkdir %{{ + IFS=" " + file="$*" + mkdir -p -- "$file" + lf -remote "send $id cd \"$(printf '%s' "$file" | sed 's/\\/\\\\/g;s/"/\\"/g')\"" }} -cmd add-file-and-edit %{{ +cmd touch %{{ IFS=" " file="$*" touch -- "$file" - file="$(printf '%s' "$file" | sed 's/\\/\\\\/g;s/"/\\"/g')" - lf -remote "send $id :select \"$file\"; \$\$EDITOR \"$file\"" + lf -remote "send $id select \"$(printf '%s' "$file" | sed 's/\\/\\\\/g;s/"/\\"/g')\"" }} # set terminal title to current working directory @@ -195,8 +186,7 @@ cmd bulk-rename ${{ a="$(cat $index | sed "${counter}q;d")" b="$(cat $index_edit | sed "${counter}q;d")" counter=$(($counter+1)) - - [ "$a" = "$b" ] && continue + [ "$a" = "$b" ] && continue [ -e "$b" ] && echo "File exists: $b" && continue mv "$a" "$b" done @@ -206,9 +196,10 @@ cmd bulk-rename ${{ rm $index $index_edit }} -cmd on-select &{{ - lf -remote "send $id set statfmt \"$(eza -ldo --color=always --smart-group --no-permissions "$f")\"" -}} +# cmd on-select &{{ +# # lf -remote "send $id set rulerfile \"$(eza -ldo --color=always --smart-group --no-permissions "$f")\"" +# lf -remote "send $id set rulerfile rulerfile +# }} cmd goto-file &{{ if [ -n "$(find -mindepth 1 -maxdepth 1 -type d -print -quit)" ]; then @@ -449,7 +440,7 @@ map ml mark-load # a = add/apply map ad add-dir map ae add-file-and-edit -map aD add-dir-and-move-selection +map adm add-dir-and-move-selection map af add-file map awc :apply-wallpaper-content map awe :apply-wallpaper-expressive @@ -473,11 +464,11 @@ map dZ delete #zap # g = goto map Ga cd ~/Applications/ -map Gc cd /media/data/nextcloud/ +map Gc cd /etc/ map Gd cd ~/dotfiles/ map Gk cd /etc/portage/patches/sys-kernel/ map Gl cd ~/.local/ -map Gn cd /media/data/nextcloud/Notizen/ +map Gn cd /media/multimedia/nextcloud/Notizen/ map Gs cd ~/Bilder/Screenshots/ map gd cd ~/Downloads/ map gc cd ~/.config/ @@ -487,6 +478,7 @@ map gF goto-file map gl follow-link map gm cd /media/ map gM cd /run/media/ +map gn cd /media/multimedia/nextcloud/ map go :fzf_jump map gt cd ~/.local/share/Trash/ map gw cd ~/Wallpapers diff --git a/dot-config/lf/rulerfile b/dot-config/lf/rulerfile new file mode 100644 index 0000000..a0f01c3 --- /dev/null +++ b/dot-config/lf/rulerfile @@ -0,0 +1,21 @@ +{{with .Message -}} + {{. -}} +{{else with .Stat -}} + {{.Permissions | printf "\033[36m%s\033[0m" -}} + {{with .LinkCount}} {{.}}{{end -}} + {{with .User}} {{.}}{{end -}} + {{with .Group}} {{.}}{{end -}} + {{.Size | humanize | printf " %5s" -}} + {{.ModTime | printf " %s" -}} + {{with .Target}} -> {{.}}{{end -}} +{{end -}} +{{.SPACER -}} +{{with .Keys}} {{.}}{{end -}} +{{with .Progress}} {{join . " "}}{{end -}} +{{with .Copy}} {{len . | printf "%s %d \033[0m" $.Options.copyfmt}}{{end -}} +{{with .Cut}} {{len . | printf "%s %d \033[0m" $.Options.cutfmt}}{{end -}} +{{with .Select}} {{len . | printf "%s %d \033[0m" $.Options.selectfmt}}{{end -}} +{{with .Visual}} {{len . | printf "%s %d \033[0m" $.Options.visualfmt}}{{end -}} +{{with .Filter}} {{join . " " | printf "\033[7;34m %s \033[0m"}}{{end -}} +{{printf " %d/%d" .Index .Total}} + -- 2.56.0