# Yeet's lf settings # Basic vars set previewer lf-ueberzug-previewer set cleaner lf-ueberzug-cleaner set preview true set drawbox true set icons true set ignorecase true set shell zsh set ifs "\n" set scrolloff 10 set period 1 set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml" # cmds/functions cmd open ${{ case $(file --mime-type $f -b) in image/vnd.djvu|application/pdf|application/octet-stream) setsid -f zathura $fx >/dev/null 2>&1 ;; text/*) $EDITOR $fx;; 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\|tif\|ico\)\(_large\)*$" | sxiv -aio 2>/dev/null | lf-select ;; audio/*) mpv --audio-display=no $f ;; video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;; *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;; esac }} cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')" cmd select_dir ${{ echo $f > /tmp/lf-chrome-choosed lf -remote "send $id quit" }} cmd extract ${{ set -f case $f in *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;; *.tar.gz|*.tgz) tar xzvf $f;; *.tar.xz|*.txz) tar xJvf $f;; *.zip) unzip $f;; *.rar) unrar x $f;; *.7z) 7z x $f;; esac }} cmd moveto ${{ clear; tput cup $(($(tput lines)/3)); tput bold set -f clear; echo "Move to where?" dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/bm-dirs | fzf | sed 's|~|$HOME|' )" && for x in $fx; do eval mv -iv \"$x\" \"$dest\" done && notify-send "File(s) moved." "File(s) moved to $dest." }} cmd copyto ${{ clear; tput cup $(($(tput lines)/3)); tput bold set -f clear; echo "Copy to where?" dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/bm-dirs | fzf | sed 's|~|$HOME|' )" && for x in $fx; do eval cp -ivr \"$x\" \"$dest\" done && notify-send " File(s) copied." "File(s) copies to $dest." }} cmd setbg ${{ echo "$fx" > /tmp/c echo convert "$fx" "$HOME/.local/backgrounds/wall.jpg" > /tmp/d convert "$fx" "$HOME/.local/backgrounds/wall.jpg" feh --no-fehbg --bg-fill "$HOME/.local/backgrounds/wall.jpg" }} cmd git_branch ${{ git branch | fzf | xargs git checkout pwd_shell=$(pwd) lf -remote "send $id updir" lf -remote "send $id cd \"$pwd_shell\"" }} 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\"" }} cmd bulkrename $vidir cmd targz %tar cvzf "$f.tar.gz" "$f" # Bindings map $lf -remote "send $id select '$(fzf)'" map gh map gg top map D $rm -r "$fx" map E extract map T targz map C copyto map M moveto map push :mkdir map reload map set hidden! map shell map x $$f map X !$f map o &mimeopen $f map O $mimeopen --ask $f map A rename # at the very end map r push A # new rename map I push A # at the very beginning map i push A # before extention map a push A # after extention map B bulkrename map b setbg map down map up map V push :!vim map cd push !cd map sd select_dir # Movement map ~ cd ~ map g/ cd / map gm cd /media map gd cd ~/.dotfiles map gc cd ~/.config map gs cd ~/.local/bin # Git Mappings map gib :git_branch map gip ${{clear; git pull --rebase || true; echo "press ENTER"; read ENTER}} map gis ${{clear; git status; echo "press ENTER"; read ENTER}} map gil ${{clear; git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit}}