# Basic Settings set preview true set drawbox true set icons true set ignorecase true set ratios 1:2:3 set scrolloff 10 set shell zsh set shellopts '-euy' set ifs "\n" # remove some of the default bindings map n map m map o map "'" map '"' map d map c map e map f # Basic Functions map . set hidden! map delete map p paste map d cut map y copy map r rename map R reload map C clear map U unselect cmd open ${{ $HOME/.config/lf/opener "$f" }} map o open # Different file openings map ee $$EDITOR "$f" map er $$READER "$f" map eb $$BOOK_READER "$f" # Execute current file map x $$f map X !$f # make directory cmd mkdir ${{ printf "Directory Name: " read ans mkdir "$ans" }} map md mkdir # make file cmd mkfile ${{ printf "File Name: " read ans $EDITOR "$ans" }} map mf mkfile # make programs executable cmd chmod ${{ printf "Mode Bits: " read ans for file in "$fx" do chmod $ans "$file" done }} map ch chmod # Archive cmd unarchive ${{ printf "Extracting:" for file in "$fx" do 7z x "$file" done }} map au unarchive # Fzf to the rescue cmd fzf_jump ${{ res="$(find . -maxdepth 1 -type d | fzf --reverse --header='Jump to location' | sed 's/\\/\\\\/g;s/"/\\"/g')" if [ -d "$res" ] ; then cmd="cd" elif [ -f "$res" ] ; then cmd="select" else exit 0 fi lf -remote "send $id $cmd \"$res\"" }} map :fzf_jump # SYMLINKING # y (select for copy) and P to paste soft-link # d (select for cut) and P to paste hard-link cmd link %{{ set -- $(cat ~/.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" }} map P :link