dotfiles

My dotfiles: zsh, lf, sxiv, i3, ranger, mpd and more
Log | Files | Refs | Submodules | README | LICENSE

lfrc (2502B)


      1 # Luke's lf settings
      2 
      3 # Basic vars
      4 set shell bash
      5 set shellopts '-eu'
      6 set ifs "\n"
      7 set scrolloff 10
      8 set color256
      9 set icons
     10 set period 1
     11 set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml"
     12 
     13 # Vars that depend on environmental variables
     14 $lf -remote "send $id set previewer ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope"
     15 
     16 # cmds/functions
     17 cmd open ${{
     18     case $(file --mime-type $f -b) in
     19 	image/vnd.djvu|application/pdf|application/octet-stream) setsid -f zathura $fx >/dev/null 2>&1 ;;
     20         text/*) $EDITOR $fx;;
     21 	image/x-xcf|image/svg+xml) setsid -f gimp $f >/dev/null 2>&1 ;;
     22 	image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\)\(_large\)*$" | sxiv -aio 2>/dev/null | lf-select ;;
     23 	audio/*) mpv --audio-display=no $f ;;
     24 	video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
     25 	application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
     26         *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;;
     27     esac
     28 }}
     29 
     30 cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')"
     31 
     32 cmd delete ${{
     33 	clear; tput cup $(($(tput lines)/3)); tput bold
     34 	set -f
     35 	printf "%s\n\t" "$fx"
     36 	printf "delete?[y/N]"
     37 	read ans
     38 	[ $ans = "y" ] && rm -rf $fx
     39 }}
     40 
     41 cmd moveto ${{
     42 	clear; tput cup $(($(tput lines)/3)); tput bold
     43 	set -f
     44 	clear; echo "Move to where?"
     45 	dest="$(cut -d'	' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf | sed 's|~|$HOME|' )" &&
     46 	for x in $fx; do
     47 		eval mv -iv \"$x\" \"$dest\"
     48 	done &&
     49 	notify-send "🚚 File(s) moved." "File(s) moved to $dest."
     50 }}
     51 
     52 cmd copyto ${{
     53 	clear; tput cup $(($(tput lines)/3)); tput bold
     54 	set -f
     55 	clear; echo "Copy to where?"
     56 	dest="$(cut -d'	' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf | sed 's|~|$HOME|' )" &&
     57 	for x in $fx; do
     58 		eval cp -ivr \"$x\" \"$dest\"
     59 	done &&
     60 	notify-send "📋 File(s) copied." "File(s) copies to $dest."
     61 }}
     62 
     63 cmd setbg "$1"
     64 cmd bulkrename $vidir
     65 
     66 # Bindings
     67 map <c-f> $lf -remote "send $id select '$(fzf)'"
     68 map J $lf -remote "send $id cd $(cut -d'	' -f2 ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)"
     69 map gh
     70 map g top
     71 map D delete
     72 map C copyto
     73 map M moveto
     74 map <c-n> push :mkdir<space>
     75 map <c-r> reload
     76 map <enter> shell
     77 map x $$f
     78 map X !$f
     79 map o &mimeopen $f
     80 map O $mimeopen --ask $f
     81 
     82 map A rename # at the very end
     83 map c push A<c-u> # new rename
     84 map I push A<c-a> # at the very beginning
     85 map i push A<a-b><a-b><a-f> # before extention
     86 map a push A<a-b> # after extention
     87 map B bulkrename
     88 map b $setbg $f
     89 
     90 map <c-e> down
     91 map <c-y> up
     92 map V push :!nvim<space>