### --- Basic Settings --- ### set autoquit true set cleaner '~/.config/lf/cleaner' set dircache false set dircounts true set dirfirst true set dirpreviews false set drawbox true set dupfilefmt '%f_%n' set hidden false set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml:*.smi:*.srt:*.ass" set history false set icons true set ifs "\n" set ignorecase true set incsearch true set incfilter true set mouse true set number true set period 1 set previewer '~/.config/lf/scope' set ratios 1:2:3 set relativenumber true set rulerfmt "%a| %p| %m| %c| %s| %v| %f| %i/%t(%h) %P %d" set scrolloff 10 set shellopts '-eu' set statfmt "\033[36m%p\033[0m| %M| %c| %u| %g| %S| %t| -> %l" set tempmarks '123456' set truncatepct 50 set info custom ### --- Custom Functions --- ### # Chmod cmd chmods ${{ options=$(printf "x\nu+x\na+x\n000\n644\n666\n755\n777") choice=$(printf "%s" "$options" | fzf) case "$choice" in "x") mod="+x";; "u+x") mod="u+x";; "a+x") mod="a+x";; "000") mod="000";; "644") mod="644";; "666") mod="666";; "755") mod="755";; "777") mod="777";; esac for file in $fx; do chmod -R $mod "$file" done printf "Permissions set to $mod for selected files/directories." lf -remote "send $id reload" }} # Compress cmd compress ${{ clear; tput cup $(($(tput lines)/3)); tput bold set -f printf "%s\n\t" "$fx" printf "compress?[y/N]" read ans [ $ans = "y" ] && { printf "%s\n\t" "$fx" printf "file name: " read ans mkdir $ans && { cp -r $fx $ans tar czf $ans.tar.gz $ans rm -rf $ans } || { printf "%s\n\t" "$fx" printf "Permissions needs.\n" printf "Continue in root?[y/N]" read root [ $root = "y" ] && { printf "Compressing $ans...\n" sudo mkdir $ans sudo cp -r $fx $ans sudo tar czf $ans.tar.gz $ans sudo rm -rf $ans } } } }} # Copy cmd copyto ${{ set -f clear; tput cup $(($(tput lines)/3)) tmpdest=$(mktemp) { sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' "${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs" findmnt -rno TARGET | grep -E "^/mnt/|^/media/$USER/" | while read -r m; do printf '%s\n' "$m" find "$m" -mindepth 1 -maxdepth 2 -type d -not -name '.*' 2>/dev/null || true done } | awk '!seen[$0]++' | fzf --layout=reverse --height 40% --prompt 'Copy to where? ' > "$tmpdest" || true IFS= read -r dest < "$tmpdest" || dest="" rm -f "$tmpdest" [ -z "$dest" ] && exit case "$dest" in "~"*) destpath="$HOME${dest#?}";; *) destpath="$dest";; esac clear; tput cup $(($(tput lines)/3)); tput bold echo "From:" echo "$fx" | sed 's/^/ /' printf "To:\n %s\n\n\tcopy?[y/N]" "$destpath" read -r ans [ "$ans" != "y" ] && exit if [ -w "$destpath" ]; then for x in $fx; do cp -ivr "$x" "$destpath"; done && notify-send "📋 File(s) copied." "File(s) copied to $destpath." else printf "\nNo write permission on %s. Use sudo?[y/N]" "$destpath" read root [ "$root" = "y" ] && { for x in $fx; do sudo cp -ivr "$x" "$destpath"; done && notify-send "📋 File(s) copied (sudo)." "File(s) copied to $destpath." } fi }} cmd yank-dirname $dirname -- "$f" | head -c-1 | xclip -i -selection clipboard cmd yank-path $printf '%s' "$fx" | xclip -i -selection clipboard cmd yank-basename $basename -a -- $fx | head -c-1 | xclip -i -selection clipboard cmd yank-basename-without-extension &basename -a -- $fx | cut -d. -f1 | head -c-1 | xclip -i -selection clipboard # Create cmd mkdir %{{ IFS=" " file="$*" mkdir -p -- "$file" printf '%s' "$file" | sed 's/\\/\\\\/g;s/"/\\"/g' | { IFS= read -r quoted || quoted="$file" lf -remote "send $id cd \"$quoted\"" } }} cmd touch %{{ IFS=" " file="$*" case "$file" in /*) ;; *) file="$PWD/$file" ;; esac dir="${file%/*}" [ "$dir" != "$file" ] && mkdir -p -- "$dir" touch -- "$file" printf '%s' "$file" | sed 's/\\/\\\\/g;s/"/\\"/g' | { IFS= read -r quoted || quoted="$file" lf -remote "send $id :select \"$quoted\"; \$\$EDITOR \"$quoted\"" } }} cmd link %{{ set -- while IFS= read -r line || [ -n "$line" ]; do set -- "$@" "$line" done < ~/.local/share/lf/files mode="$1" shift if [ "$#" -lt 1 ]; then lf -remote "send $id echo no files to link" exit 0 fi case "$mode" in # symbolically copy mode is indicating a soft link copy) ln -sr -t . -- "$@";; # while a move mode is indicating a hard link move) ln -t . -- "$@";; esac rm ~/.local/share/lf/files lf -remote "send clear" }} # Cut cmd cut-add %{{ sed '1s/.*/move/' "$XDG_DATA_HOME/lf/files" > "$XDG_DATA_HOME/lf/files.tmp" mv "$XDG_DATA_HOME/lf/files.tmp" "$XDG_DATA_HOME/lf/files" echo "$fx" >> "$XDG_DATA_HOME/lf/files" lf -remote "send $id unselect" lf -remote "send $id sync" }} cmd cut-remove %{{ sed '1s/.*/move/' "$XDG_DATA_HOME/lf/files" > "$XDG_DATA_HOME/lf/files.tmp" mv "$XDG_DATA_HOME/lf/files.tmp" "$XDG_DATA_HOME/lf/files" echo "$fx" | while read -r file; do sed "\|$file|d" "$XDG_DATA_HOME/lf/files" > "$XDG_DATA_HOME/lf/files.tmp" mv "$XDG_DATA_HOME/lf/files.tmp" "$XDG_DATA_HOME/lf/files" done lf -remote "send $id unselect" lf -remote "send $id sync" }} # Delete cmd delete ${{ clear; tput cup $(($(tput lines)/3)); tput bold set -f printf "%s\n\t" "$fx" printf "delete?[y/N]" read ans [ $ans = "y" ] && { rm -rf -- $fx 2>/dev/null || { printf "sudo delete?[y/N]" read ans [ $ans = "y" ] && sudo rm -rf -- $fx } } }} cmd trash ${{ set -f trash-put -- $fx 2>/dev/null || { printf "sudo trash?[y/N]" read ans [ "${ans:-}" = "y" ] && sudo trash-put -- $fx } }} cmd restore_trash ${{ trash-restore }} # Drag & Drop cmd dragon &{{ dragon-drop -a -x $fx lf -remote "send $id :unselect; save-select" }} cmd dragon-stay &{{ dragon-drop -a $fx lf -remote "send $id :unselect; save-select" }} cmd dragon-individual &{{ dragon-drop $fx lf -remote "send $id :unselect; save-select" }} cmd dragon-target ${{ dragon-drop -t -x | while IFS= read -r src; do [ -e "$src" ] && cp -ivr "$src" "$PWD" done lf -remote "send $id :unselect; save-select" }} # File Manager cmd fm ${{ setsid -f ${FM:-thunar} "$PWD" >/dev/null 2>&1 }} # Extract cmd extract ${{ clear; tput cup $(($(tput lines)/3)); tput bold set -f printf "%s\n\t" "$fx" printf "extract?[y/N]" read ans [ "$ans" != "y" ] && exit for archive in $fx; do [ -e "$archive" ] || continue case "$archive" in /*) archive_abs="$archive";; *) archive_abs="$PWD/$archive";; esac base="${archive##*/}" tar_flag="" type="" name="" case "$base" in *.tar.bz2) name="${base%.tar.bz2}"; type=tar; tar_flag=j;; *.tar.bz) name="${base%.tar.bz}"; type=tar; tar_flag=j;; *.tbz2) name="${base%.tbz2}"; type=tar; tar_flag=j;; *.tbz) name="${base%.tbz}"; type=tar; tar_flag=j;; *.tar.gz) name="${base%.tar.gz}"; type=tar; tar_flag=z;; *.tgz) name="${base%.tgz}"; type=tar; tar_flag=z;; *.tar.xz) name="${base%.tar.xz}"; type=tar; tar_flag=J;; *.txz) name="${base%.txz}"; type=tar; tar_flag=J;; *.tar) name="${base%.tar}"; type=tar;; *.zip|*.jar|*.war|*.7z) name="${base%.*}"; type=7z;; *.rar) name="${base%.rar}"; type=rar;; *.exe) name="${base%.exe}"; type=cab;; *.ace) name="${base%.ace}"; type=ace;; *.bz2) bunzip2 "$archive"; continue;; *.gz) gunzip "$archive"; continue;; *.xz) unxz "$archive"; continue;; *.lzma) unlzma "$archive"; continue;; *.Z) uncompress "$archive"; continue;; *) printf "Unknown archive type: %s\n" "$archive"; continue;; esac # count only (ASCII) — entry names must not pass through dash's $() case "$type" in tar) count=$(tar tf "$archive" 2>/dev/null | awk -F/ 'NF{print $1}' | sort -u | grep -c . || true);; 7z) count=$(7z l -slt -ba "$archive" 2>/dev/null | awk -F'= ' '/^Path = /{print $2}' | awk -F/ 'NF{print $1}' | sort -u | grep -c . || true);; rar) count=$(unrar lb "$archive" 2>/dev/null | awk -F/ 'NF{print $1}' | sort -u | grep -c . || true);; *) count=0;; esac target="." if [ "$count" != "1" ]; then printf "\n'%s' has %s top-level entries.\nExtract into folder '%s'? [Y/n] " "$base" "$count" "$name" read folder_ans if [ "$folder_ans" != "n" ] && [ "$folder_ans" != "N" ]; then mkdir -p -- "$name" target="$name" fi fi case "$type" in tar) tar x${tar_flag}f "$archive" -C "$target";; 7z) 7z x "$archive" -o"$target";; rar) (cd "$target" && unrar x "$archive_abs");; cab) (cd "$target" && cabextract "$archive_abs");; ace) (cd "$target" && unace x "$archive_abs");; esac done }} # Git cmd git-root %{{ { git rev-parse --show-toplevel 2>/dev/null || true; } | { IFS= read -r root || root="" if [ -n "$root" ]; then lf -remote "send $id cd \"$root\"" else lf -remote "send $id echo 'Not in a git repository'" fi } }} cmd on-cd &{{ zoxide add "$PWD" bash -c ' # display git repository status in your prompt source /usr/share/git/completion/git-prompt.sh GIT_PS1_SHOWDIRTYSTATE=auto GIT_PS1_SHOWSTASHSTATE=auto GIT_PS1_SHOWUNTRACKEDFILES=auto GIT_PS1_SHOWUPSTREAM=auto git=$(__git_ps1 " (%s)") fmt="\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f$git\033[0m" lf -remote "send $id set promptfmt \"$fmt\"" ' }} cmd on-load &{{ dir="${1%/*}" cd "${dir:-/}" || exit 1 [ "$(git rev-parse --is-inside-git-dir 2>/dev/null)" = false ] || exit 0 cmds="" for file in "$@"; do case "$file" in */.git|*/.git/*) continue;; esac status=$(git status --porcelain --ignored -- "$file" | cut -c1-2 | head -n1) if [ -n "$status" ]; then cmds="${cmds}addcustominfo \"${file}\" \"$status\"; " else cmds="${cmds}addcustominfo \"${file}\" ''; " fi done if [ -n "$cmds" ]; then lf -remote "send $id :$cmds" fi }} # iPython cmd create-ipynb ${{ clear; tput cup $(($(tput lines)/3)); tput bold printf "File Name: " read ans vipy $ans }} # Move cmd moveto ${{ set -f clear; tput cup $(($(tput lines)/3)) tmpdest=$(mktemp) { sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' "${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs" findmnt -rno TARGET | grep -E "^/mnt/|^/media/$USER/" | while read -r m; do printf '%s\n' "$m" find "$m" -mindepth 1 -maxdepth 2 -type d -not -name '.*' 2>/dev/null || true done } | awk '!seen[$0]++' | fzf --layout=reverse --height 40% --prompt 'Move to where? ' > "$tmpdest" || true IFS= read -r dest < "$tmpdest" || dest="" rm -f "$tmpdest" [ -z "$dest" ] && exit case "$dest" in "~"*) destpath="$HOME${dest#?}";; *) destpath="$dest";; esac clear; tput cup $(($(tput lines)/3)); tput bold echo "From:" echo "$fx" | sed 's/^/ /' printf "To:\n %s\n\n\tmove?[y/N]" "$destpath" read -r ans [ "$ans" != "y" ] && exit if [ -w "$destpath" ]; then for x in $fx; do mv -iv "$x" "$destpath"; done && notify-send "🚚 File(s) moved." "File(s) moved to $destpath." else printf "\nNo write permission on %s. Use sudo?[y/N]" "$destpath" read root [ "$root" = "y" ] && { for x in $fx; do sudo mv -iv "$x" "$destpath"; done && notify-send "🚚 File(s) moved (sudo)." "File(s) moved to $destpath." } fi }} # MPV cmd mpvdir ${{ if [ -n "$fx" ]; then set -- $fx setsid -f mpv --x11-name=video --really-quiet -- "$@" /dev/null 2>&1 else tmplist=$(mktemp) printf '%s\n' *.mp4 *.mkv *.avi *.flv *.webm *.mov *.mpg *.3gp *.ts *.rmvb | sort -f > "$tmplist" set -- while IFS= read -r file; do [ -e "$file" ] && set -- "$@" "$file" done < "$tmplist" rm -f "$tmplist" [ "$#" -gt 0 ] && setsid -f mpv --x11-name=video --really-quiet -- "$@" /dev/null 2>&1 fi lf -remote "send $id :clear; unselect; save-select" }} # Open cmd open ${{ case $(file -bL --mime-type -- "$f") in application/octet-stream) case ${f##*.} in ppt|pptx) setsid -f libreoffice --impress $fx >/dev/null 2>&1 ;; doc|docx|odt) setsid -f libreoffice --writer $fx >/dev/null 2>&1 ;; xls|xlsx) setsid -f libreoffice --calc $fx >/dev/null 2>&1 ;; ghw) setsid -f gtkwave $f >/dev/null 2>&1 ;; ts) setsid -f mpv --x11-name=video --really-quiet -- "$f" /dev/null 2>&1 ;; *) setsid -f zathura $fx >/dev/null 2>&1 ;; esac ;; application/epub*|application/pdf|application/postscript|application/vnd.djvu|image/vnd.djvu) setsid -f zathura $fx >/dev/null 2>&1 ;; application/pgp-encrypted) $EDITOR $fx ;; application/vnd.oasis.opendocument.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.ms-powerpoint|application/vnd.openxmlformats-officedocument.presentationml.presentation) setsid -f libreoffice --impress $fx >/dev/null 2>&1 ;; application/vnd.oasis.opendocument.text|application/x-hwp|application/vnd.openxmlformats-officedocument.wordprocessingml.document) setsid -f libreoffice --writer $fx >/dev/null 2>&1 ;; application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template) setsid -f libreoffice --calc $fx >/dev/null 2>&1 ;; application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template) setsid -f libreoffice --draw $fx >/dev/null 2>&1 ;; application/vnd.oasis.opendocument.formula|application/vnd.oasis.opendocument.database) setsid -f libreoffice $fx >/dev/null 2>&1 ;; audio/*|video/x-ms-asf) setsid -f mpv --volume=50 --x11-name=music --force-window=yes --audio-display=embedded-first --really-quiet -- "$f" /dev/null 2>&1 ; lf -remote "send $id redraw" ;; 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 -aiop 2>/dev/null | while read -r file; do [ -z "$file" ] && continue lf -remote "send select \"$file\"" lf -remote "send toggle" done & ;; text/csv|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) sc-im $fx;; text/html|text/xml) lynx $fx;; text/troff) groff -mom $fx -Tpdf | zathura - ;; text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;; video/*) setsid -f mpv --x11-name=video --really-quiet -- "$f" /dev/null 2>&1 ; lf -remote "send $id redraw" ;; *) for f in $fx; do setsid -f ${OPENER:-xdg-open} $f >/dev/null 2>&1; done;; esac }} # Rename cmd bulkrename ${{ tmpfile_old="$(mktemp)" tmpfile_new="$(mktemp)" tmpfile_failed="$(mktemp)" # NOTE: avoid command substitution over multibyte data — dash's $() corrupts # UTF-8 chars straddling its 128-byte read buffer (stray 0x81 CTLESC bytes) if [ -n "$fs" ]; then printf '%s\n' "$fs" | xargs -d '\n' -r basename -a -- > "$tmpfile_old" elif [ "$lf_hidden" = "true" ]; then ls -A > "$tmpfile_old" else ls > "$tmpfile_old" fi cp "$tmpfile_old" "$tmpfile_new" $EDITOR "$tmpfile_new" [ "$(wc -l < "$tmpfile_old")" -eq "$(wc -l < "$tmpfile_new")" ] || { rm -f "$tmpfile_old" "$tmpfile_new" "$tmpfile_failed"; exit 1; } paste "$tmpfile_old" "$tmpfile_new" | while IFS="$(printf '\t')" read -r src dst do [ "$src" = "$dst" ] || [ -e "$dst" ] || mv -- "$src" "$dst" 2>/dev/null || printf '%s\t%s\n' "$src" "$dst" >> "$tmpfile_failed" done if [ -s "$tmpfile_failed" ]; then clear; tput cup $(($(tput lines)/3)); tput bold cut -f1 "$tmpfile_failed" printf "Permission needed for %s file(s). Rename with sudo?[y/N]" "$(wc -l < "$tmpfile_failed")" read -r ans [ "$ans" = "y" ] && while IFS="$(printf '\t')" read -r src dst do sudo mv -- "$src" "$dst" done < "$tmpfile_failed" fi rm -f "$tmpfile_old" "$tmpfile_new" "$tmpfile_failed" lf -remote "send $id unselect" }} # Samba cmd share-samba ${{ printf "%s\n\t" "$fx" printf "Share this folder?[y/N]" read ans [ $ans = "y" ] && dmenusamba "$f" }} # Select cmd select-mime &{{ set -f [ "$#" -eq 0 ] && exit case "$1" in -*) pattern="${1#-}" find "$PWD" -mindepth 1 -maxdepth 1 \ $([ "$lf_hidden" = false ] && printf '%s\n' ! -name '.*') -print | file -L --mime-type -f - | grep -v "$pattern" | cut -d: -f1 | sort -f > /tmp/lf-select-mime-$$ ;; *) find "$PWD" -mindepth 1 -maxdepth 1 \ $([ "$lf_hidden" = false ] && printf '%s\n' ! -name '.*') -print | file -L --mime-type -f - | grep "$1" | cut -d: -f1 | sort -f > /tmp/lf-select-mime-$$ ;; esac [ -s /tmp/lf-select-mime-$$ ] || { rm -f /tmp/lf-select-mime-$$; exit; } lf -remote "send $id unselect" sed 's/\\/\\\\/g;s/"/\\"/g' /tmp/lf-select-mime-$$ > /tmp/lf-select-mime-q-$$ batch="" while IFS= read -r quoted; do candidate="$batch \"$quoted\"" if [ ${#candidate} -gt 8000 ]; then lf -remote "send $id toggle $batch" batch="\"$quoted\"" else batch="$candidate" fi done < /tmp/lf-select-mime-q-$$ [ -n "$batch" ] && lf -remote "send $id toggle $batch" rm -f /tmp/lf-select-mime-$$ /tmp/lf-select-mime-q-$$ }} cmd select-dirs select-mime 'inode/directory' cmd select-files select-mime '-inode/directory' cmd select-videos select-mime 'video/' cmd select-images select-mime 'image/' cmd select-music select-mime 'audio/' cmd on-select &{{ eza -ldg --color=always "$f" | { IFS= read -r line || line="" lf -remote "send $id set statfmt \"$line\"" } }} cmd load-select &{{ if [ $# -eq 1 ] && [ "$1" = "$id" ]; then exit fi lf -remote "send $id unselect" if [ -s ~/.local/share/lf/select ]; then tmpq=$(mktemp) sed 's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$/"/' ~/.local/share/lf/select > "$tmpq" files="" while IFS= read -r line || [ -n "$line" ]; do files="$files $line" done < "$tmpq" rm -f "$tmpq" lf -remote "send $id toggle $files" fi }} cmd save-select &{{ printf "%s" "$fs" > ~/.local/share/lf/select lf -remote "send load-select $id" }} cmd alt-paste &{{ [ -n "$fs" ] && lf -remote "send $id :$1; save-select" lf -remote "send $id paste" || { clear; tput cup $(($(tput lines)/3)); tput bold set -f printf "%s\n\t" "$fx" printf "Permissions needs.\n" printf "Continue in root?[y/N]" read root [ $root = "y" ] && sudo lf -remote "send $id paste" } lf -remote "send $id :clear" }} # Traversal cmd fzf ${{ tmpsel=$(mktemp) find . -name "$1" | fzf > "$tmpsel" || true IFS= read -r sel < "$tmpsel" || sel="" rm -f "$tmpsel" if [ -n "$sel" ]; then nvim -- "$sel"; fi }} cmd fzf_search ${{ RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case " FZF_DEFAULT_COMMAND="$RG_PREFIX ''" \ fzf --bind "change:reload:$RG_PREFIX {q} || true" \ --ansi --layout=reverse --header 'Search in files' \ | cut -d':' -f1 | sed 's/\\/\\\\/g;s/"/\\"/g' | { IFS= read -r res || res="" if [ -n "$res" ]; then lf -remote "send $id select \"$res\""; fi } }} cmd z %{{ { zoxide query --exclude $PWD $@ 2>/dev/null || true; } | sed 's/\\/\\\\/g;s/"/\\"/g' | { IFS= read -r result || result="" if [ -n "$result" ]; then lf -remote "send $id cd \"$result\""; fi } }} cmd zi ${{ { zoxide query -i 2>/dev/null || true; } | sed 's/\\/\\\\/g;s/"/\\"/g' | { IFS= read -r result || result="" if [ -n "$result" ]; then lf -remote "send $id cd \"$result\""; fi } }} cmd follow_link %{{ { readlink -- "$f" || true; } | sed 's/\\/\\\\/g;s/"/\\"/g' | { IFS= read -r target || target="" if [ -n "$target" ]; then lf -remote "send ${id} select \"$target\""; fi } }} cmd lastfiles ${{ tmplist=$(mktemp) tmpsel=$(mktemp) nvim -u NONE --headless +'lua io.write(table.concat(vim.v.oldfiles, "\n") .. "\n")' +qa > "$tmplist" while IFS= read -r file; do [ -f "$file" ] && printf "%s\n" "$file" done < "$tmplist" | fzf --reverse > "$tmpsel" || lf -remote "send $id reload" IFS= read -r file < "$tmpsel" || file="" rm -f "$tmplist" "$tmpsel" if [ -n "$file" ]; then $EDITOR "$file"; fi }} cmd edit-config ${{ $EDITOR ~/.config/lf/lfrc lf -remote "send $id source ~/.config/lf/lfrc" }} cmd wine-run ${{ if [ "$(file -bL --mime-type -- "$f")" = "application/vnd.microsoft.portable-executable" ]; then file="${f##*/}" file="${file%.*}" export WINEPREFIX="${WINEPREFIX:-${XDG_DATA_HOME:-${HOME}/.local/share}/wine}/$file" wine $f fi }} # Wallpaper cmd setbg "$1" cmd setlock "$1" ### --- Bindings --- ### # Unbinding map b map c map d map f map g map H map M map p map s map t map v map w map y map z # Shortcuts source ~/.config/lf/shortcutrc # Chmod map zx chmods # Clear && Unselect map :clear; unselect; save-select map :clear; unselect; save-select # Compress map Cc compress # Copy # map yy %cp -ri -- $fs .; clear map Cp copyto; clear; save-select map Y $printf "%s" "$fx" | xclip -selection clipboard; clear; save-select map yb yank-basename map yd yank-dirname map yl $printf "%s" "$fx" | sed -E 's/^.+\[/https:\/\/piped.video\/watch?v=/' | sed -E 's/\]\..+//' | xclip -selection clipboard map yn yank-basename-without-extension map yp yank-path map yt $printf "%s" "$fx" | sed -E 's/^.+\[/https:\/\/www.youtube.com\/watch?v=/' | sed -E 's/\]\..+//' | xclip -selection clipboard map yy copy # Create map Md push :mkdir map Mf push :touch map Ml link # Cut map dd cut-add map dr cut-remove # Delete map D trash; clear; save-select map delete; clear; save-select # Drag & Drop map dga dragon map dgs dragon-stay map dgi dragon-individual map dgt dragon-target # Editor map $$EDITOR "$f" map push :!nvim map vlf edit-config map vll lastfiles map vln $nvim -u NONE --headless +'lua io.write(vim.v.oldfiles[1] .. "\n")' +qa | { IFS= read -r file || exit 0; if [ -f "$file" ]; then $EDITOR "$file" < /dev/tty; fi; } # Extract map E extract; clear; save-select # Info map za set info size:time map zc set info custom map zh set hidden! map zn set info map zr set reverse! map zs set info size map zt set info time # iPython map Mi create-ipynb # Move map Mv moveto; clear; save-select # MPV map Mpv mpvdir # Nsxiv map th $nsxiv -apt "$PWD" # Open map O $mimeopen "$f" map o open map $mimeopen --ask "$f" # Paste map PP alt-paste cut map pp alt-paste copy # Preview map zd set dirpreviews! map zp set preview! # Program map T $setsid -f $TERMINAL >/dev/null 2>&1 map x $$f map X !$f # Quit map quit map quit # Rename map a :rename; cmd-right # after extension map A :rename; cmd-end # at the very end map B bulkrename map r :rename; cmd-delete-home # filename map R :rename; cmd-end; cmd-delete-home # entire filename map i :rename # before extension map I :rename; cmd-home # at the very beginning # Redraw && Reload map :redraw; reload # Restore map U restore_trash # Samba map SMB share-samba # Select map :toggle; down; save-select map sd select-dirs map sf select-files map si :invert; save-select map sm select-music map sp select-images map su :unselect; save-select map sU :glob-unselect; save-select map sv select-videos # Sort map sa :set sortby atime; set info atime map sb :set sortby btime; set info btime map sc :set sortby ctime; set info ctime map se :set sortby ext; set info map sn :set sortby natural; set info map ss :set sortby size; set info size map st :set sortby time; set info time # Tag map tg tag-toggle # Traversal map fa $fzf | { IFS= read -r sel || exit 0; lf -remote "send $id select \"$sel\""; } map fb $sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | { IFS= read -r d || exit 0; case "$d" in "~"*) d="$HOME${d#?}";; esac; lf -remote "send $id cd \"$d\""; } map fD zi map fd $find . -type d | fzf | { IFS= read -r sel || exit 0; lf -remote "send $id select \"$sel\""; } map ff $find . -type f | fzf | { IFS= read -r sel || exit 0; lf -remote "send $id select \"$sel\""; } map fm fm map gl follow_link map gc git-root map fzf_search map z # Wallpaper map bg $setbg "$f" map bl $setlock "$f" # Wine map wi wine-run load-select on-cd