-#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!\""
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/)
}}
# compress current file or selected files with tar and gzip, preserving permissions
-cmd tgz ${{
+cmd tgzp ${{
set -f
mkdir $1
cp -r $fx $1
rm -rf $1
}}
-
# compress current file or selected files with tar and xz, preserving permissions
cmd txzp ${{
set -f
rm -rf $1
}}
-
# compress current file or selected files with tar and zstd
cmd tzstd ${{
set -f
rm -rf $1
}}
-
# compress current file or selected files with tar and zstd, preserving permissions
cmd tzstdp ${{
set -f
}}
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 ${{
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' ';')
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"
read -r newd
mkdir -- "$newd"
mv -- $fx "$newd"
-}}
+}}
# ------------------------------------ commands:
# helpers
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
# 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<space>
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
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
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
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<space>
+map xt push :open-with-cli<space>
+
# one-shot commands
map R bulk-rename
map J move-parent down
map '%' : select-all
# various commands
-map ~
+map <esc> unselect
map ~ toggle_preview
map C edit-config
map + push :glob-select<space>
map - push :glob-unselect<space>
-map <enter> push :open-with-gui<space>
-map <a-enter> push :open-with-cli<space>
+# map <enter> push :open-with-gui<space>
+# map <a-enter> push :open-with-cli<space>
+map <c-f> $lf -remote "send $id select '$(fzf)'"
+