# Basic settings set shell sh set preview false set icons true set hidden true set drawbox true set ignorecase true # Custom functions cmd open ${{ case "${f##*.}" in org) emacsclient -c "$f";; *) case $(file --mime-type "$f" -bL) in text/*|application/json) nvim "$f";; video/*|image/*/application/pdf) xdg-open "$f" & disown;; *) xdg-open "$f" ;; esac esac }} cmd mkdir ${{ printf "Directory Name: " read ans mkdir $ans }} cmd mkfile ${{ printf "File Name: " read ans nvim $ans }} cmd chmod ${{ printf "Mode Bits: " read ans for file in "$fx" do chmod $ans $file done }} cmd doasmkfile ${{ printf "File Name: " read ans doas nvim $ans }} cmd broot_jump ${{ f=$(mktemp) res="$(broot --outcmd $f && cat $f | sed 's/cd //')" rm -f "$f" if [ -f "$res" ]; then cmd="select" elif [ -d "$res" ]; then cmd="cd" fi lf -remote "send $id $cmd \"$res\"" }} # Archive bindings cmd extract ${{ case "$f" in *.zip) unzip "$f" ;; *.tar.gz) tar -xzvf "$f" ;; *.tar.bz2) tar -xjvf "$f" ;; *.tar) tar -xvf "$f" ;; *) echo "Unsupported format" ;; esac }} # View image cmd viewimage ${{ if [ -d "$f" ]; then sxiv -q -f -t "$f" else sxiv -q -f "$f" fi }} # Show progress bar for file copies cmd paste &{{ load=$(lf -remote 'load') mode=$(echo "$load" | sed -n '1p') list=$(echo "$load" | sed '1d') if [ $mode = 'copy' ]; then rsync -av --ignore-existing --progress $list . \ | stdbuf -i0 -o0 -e0 tr '\r' '\n' \ | while read line; do lf -remote "send $id echo $line" done elif [ $mode = 'move' ]; then mv -n $list . fi lf -remote 'send load' lf -remote 'send clear' }} cmd zip %zip -r "$f" "$f" cmd tar %tar cvf "$f.tar" "$f" cmd targz %tar cvzf "$f.tar.gz" "$f" cmd tarbz2 %tar cjvf "$f.tar.bz2" "$f" # Trash cli bindings cmd trash ${{ files=$(echo "$fx" | sed "s/ /\\\ /g;s/\[/\\\[/g;s/\]/\\\]/g") IFS=$'\n' for file in $files do trash-put "$(basename "$file")" done }} cmd clear_trash %trash-empty cmd restore_trash ${{ trash-restore }} # Bindings # Remove some defaults map m map o map n map "'" map '"' map d map c map e map f # File Openers map ee nvim "$f" # Archive Mappings map az zip map at tar map ag targz map ab targz map ae extract # Trash Mappings map dd trash map tc clear_trash map tr restore_trash # Broot Mapping map f broot_jump # Basic Functions map . set hidden! map DD delete map p paste map x cut map y copy map open map mf mkfile map mr doasmkfile map md mkdir map ch chmod map o open_config map r rename map H top map L bottom map R reload map C clear map U unselect map i viewimage # Movement map gd. cd ~/Documents map gD cd ~/Downloads map gdbb cd ~/Documents/Business/Boekhouding map gdbi cd ~/Documents/Business/Interne\ zaken map gdf cd ~/Documents/Finances map gddd cd ~/Documents/Data\ Dumps map gdl cd ~/Documents/ledger map gdo cd ~/Documents/org map gs cd ~/Sync map gm. cd ~/music map gw. cd ~/Pictures/wallpaper/ map gww cd ~/Pictures/wallpaper/Wallpaper map gws cd ~/Pictures/wallpaper/Wallpaper\ Small map gw9 cd ~/Pictures/wallpaper/Wallpaper\ 90