From: Andre Ramnitz Date: Mon, 18 Nov 2024 22:56:36 +0000 (+0100) Subject: lf: update config X-Git-Url: https://git.ramnitz.eu/?a=commitdiff_plain;h=65582678bfb7f3adaae25744dc138f5f1eeb4622;p=dotfiles.git lf: update config --- diff --git a/dot-config/lf/lfrc b/dot-config/lf/lfrc index 73f3bfd0..709aa41f 100644 --- a/dot-config/lf/lfrc +++ b/dot-config/lf/lfrc @@ -1,4 +1,4 @@ -#vim: noai:ft=conf:ts=4:sw=4 +#vim: noai:ft=sh:ts=4:sw=4 # warn on nested instances &[ $LF_LEVEL -eq 1 ] || lf -remote "send $id echoerr \"Warning: You're in a nested lf instance!\"" @@ -66,6 +66,10 @@ cmd add-file ${{ touch $ans }} +# set terminal title to current working directory +cmd on-cd &{{ + printf "\033]0; $PWD\007" > /dev/tty +}} # extract the current file with the right command # (xkcd link: https://xkcd.com/1168/) @@ -91,7 +95,7 @@ cmd tgz ${{ }} # compress current file or selected files with tar and gzip, preserving permissions -cmd tgz ${{ +cmd tgzp ${{ set -f mkdir $1 cp -r $fx $1 @@ -108,7 +112,6 @@ cmd txz ${{ rm -rf $1 }} - # compress current file or selected files with tar and xz, preserving permissions cmd txzp ${{ set -f @@ -118,7 +121,6 @@ cmd txzp ${{ rm -rf $1 }} - # compress current file or selected files with tar and zstd cmd tzstd ${{ set -f @@ -128,7 +130,6 @@ cmd tzstd ${{ rm -rf $1 }} - # compress current file or selected files with tar and zstd, preserving permissions cmd tzstdp ${{ set -f @@ -177,7 +178,7 @@ cmd bulk-rename ${{ }} cmd on-select &{{ - lf -remote "send $id set statfmt \"$(eza -ld --color=always -o --no-permissions "$f")\"" + lf -remote "send $id set statfmt \"$(eza -ldo --color=always --smart-group --no-permissions "$f")\"" }} cmd fzf_jump ${{ @@ -218,6 +219,16 @@ cmd toggle_preview %{{ fi }} +# Create a directory with the selected items +# borrowed from https://github.com/rockyzhang24/dotfiles/blob/c1c338d324998ba6d13e9cbb1b2420a931717829/.config/lf/lfrc +cmd add-dir-and-move-selection ${{ + set -f + printf "Directory name: " + read newd + mkdir -- "$newd" + mv -- $fx "$newd" +}} + # Trash cli bindings cmd trash ${{ files=$(printf "$fx" | tr '\n' ';') @@ -245,6 +256,18 @@ cmd trash-restore ${{ trash-restore }} +# chmod +cmd chmod %{{ + printf "Mode Bits: " + read and + + for file in "$fx" + do + chmod $and "$file" + done + lf -remote 'send reload' +}} + cmd move-parent &{{ dironly="setlocal '$(dirname "$PWD")' dironly" lf -remote "send $id :updir; $dironly true; $1; $dironly false; open" @@ -328,7 +351,7 @@ cmd selected-to-new-folder ${{ read -r newd mkdir -- "$newd" mv -- $fx "$newd" -}} +}} # ------------------------------------ commands: # helpers @@ -336,6 +359,7 @@ cmd open-with-gui &$@ $fx # opens asynchronously, intended for GUI applications cmd open-with-cli $$@ $fx # opens synchronously, intended for CLI/TUI applications cmd apply-wallpaper %{{swww img $f}} cmd chdir cd "$@" +cmd open-terminal-here &setsid -f "${TERMINAL}" >/dev/null 2>&1 # options per location setlocal ~ sortby name @@ -363,14 +387,15 @@ map ml mark-load # a = add/apply map ad add-dir +map aD add-dir-and-move-selection map af add-file map aw :apply-wallpaper # c = change map cd push :cd map cw : rename -map cm selected-to-new-folder map cy yank-file $printf '%s' "$f" | wl-copy -p -n +map cm chmod # d = delete map dd cut @@ -379,8 +404,10 @@ map dr trash-restore map dZ delete #zap # g = goto +map ga cd ~/Applications/ map gc cd ~/.config -map gd cd ~/dotfiles +map gd cd ~/Downloads/ +map gD cd ~/dotfiles/ map gf :fzf_search map gl cd ~/.local map gL follow-link @@ -389,6 +416,7 @@ map gM cd /mnt map ge bottom map gs cd ~/Bilder/Screenshots map go :fzf_jump +map gt cd ~/.local/share/Trash/ map gw cd ~/Bilder/Wallpapers # o = order @@ -416,6 +444,12 @@ map Q : quit map sd select-dirs map sf select-files +# x = extract/execute +map xe extract +map xt open-cwd-in-terminal +map xg push :open-with-gui +map xt push :open-with-cli + # one-shot commands map R bulk-rename map J move-parent down @@ -425,10 +459,12 @@ map \| shell-pipe map '%' : select-all # various commands -map ~ +map unselect map ~ toggle_preview map C edit-config map + push :glob-select map - push :glob-unselect -map push :open-with-gui -map push :open-with-cli +# map push :open-with-gui +# map push :open-with-cli +map $lf -remote "send $id select '$(fzf)'" +