# Basic Settings set previewer ~/.config/lf/preview set preview true # set drawbox true # set icons true set ignorecase true set scrolloff 1 set shell zsh # unmap keys map y map d map m # keymappings # rename map C rename # at the end map c push C map push C # new rename map B bulk-rename # fix this # lf commands map H set hidden! map reload # cut/copy/paste map p paste map yy copy map dd cut map D delete # new files/directories map md push :mkdir map mf push :mkfile map mF push :touch # opening files map o push :open-with map L open_ext map P share # selecting files/globs map t toggle # custom commands cmd open ${{ case $(file --mime-type "$f" -bL) in text/*|application/json) $EDITOR "$f";; *) xdg-open "$f" ;; esac }} # open in another terminal cmd open_ext ${{ case $(file --mime-type "$f" -bL) in text/*|application/json) $TERMINAL "-e" $EDITOR "$f";; *) xdg-open "$f" ;; esac }} # cmd mkdir ${{ # set -f # printf "Directory Name: " # read ans # mkdir $ans # }} # cmd mkfile ${{ # printf "File Name: " # read ans # $EDITOR $ans # }} # cmd mkdir %mkdir "$@" cmd mkdir %{{ IFS=" " mkdir -p -- "$*" lf -remote "send $id select \"$*\"" }} cmd mkfile %nvim "$@" # cmd touch %touch "$@" cmd touch %{{ IFS=" " touch "$*" lf -remote "send $id select \"$*\"" }} cmd chmod ${{ printf "Mode Bits: " read ans for file in "$fx" do chmod $ans $file done lf -remote 'send reload' }} cmd open-with %"$@" $fx cmd share $curl -F"file=@$fx" https://0x0.st | xclip -selection c # bulk rename non-hidden or selected files # cmd bulk-rename ${{ # old="$(mktemp)" # new="$(mktemp)" # [ -n "$fs" ] && fs="$(ls)" # printf '%s\n' "$fs" >"$old" # printf '%s\n' "$fs" >"$new" # $EDITOR "$new" # [ "$(wc -l "$new")" -ne "$(wc -l "$old")" ] && exit # paste "$old" "$new" | while IFS= read -r names; do # src="$(printf '%s' "$names" | cut -f1)" # dst="$(printf '%s' "$names" | cut -f2)" # if [ "$src" = "$dst" ] || [ -e "$dst" ]; then # continue # fi # mv -- "$src" "$dst" # done # rm -- "$old" "$new" # lf -remote "send $id unselect" # }} # override paste with cp-p # cmd paste $cp-p --lf-paste $id # archive bindings cmd unarchive ${{ case "$f" in *.zip) unzip "$f" ;; *.tar.gz) tar -xzvf "$f" ;; *.tar.bz2) tar -xjvf "$f" ;; *.tar) tar -xvf "$f" ;; *) echo "Unsupported format" ;; esac }} 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" # archive mappings map az zip map at tar map ag targz map ab targz map au unarchive # this runs on each directory change cmd on-cd &{{ # 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_PS1_COMPRESSSPARSESTATE=auto git=$(__git_ps1 " [GIT BRANCH:> %s]") || true fmt="\033[32;1m%u@%h\033[0m:\033[34;1m%w\033[0m\033[33;1m$git\033[0m" lf -remote "send $id set promptfmt \"$fmt\"" # update window title printf "\033]0; $PWD\007" > /dev/tty }} # set number of columns depending # on window size on startup # %{{ # w=$(tput cols) # if [ $w -le 80 ]; then # lf -remote "send $id set ratios 1:2" # elif [ $w -le 160 ]; then # lf -remote "send $id set ratios 1:2:3" # else # lf -remote "send $id set ratios 1:2:3:5" # fi # }}