Krolyxon
Commit 164c9d2

Branches

Refs →

dotfiles-x11.configlflfrc

116 lines · 3.2 KB

1# Basic vars
2set shellopts '-eu'
3set ifs "\n"
4set scrolloff 10
5set icons
6set hidden true
7set drawbox true
8set period 1
9set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml"
10set cleaner '~/.config/lf/cleaner'
11set previewer '~/.config/lf/scope'
12
13# cmds/functions
14cmd open ${{
15 case $(file --mime-type "$(readlink -f $f)" -b) in
16 application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;;
17 image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;;
18 text/*|application/json|inode/x-empty) $EDITOR $fx;;
19 image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;;
20 image/svg+xml) display -- $f ;;
21 image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" |
22 setsid -f sxiv -aio 2>/dev/null | while read -r file; do
23 [ -z "$file" ] && continue
24 lf -remote "send select \"$file\""
25 lf -remote "send toggle"
26 done &
27 ;;
28 audio/*) mpv --audio-display=no $f ;;
29 video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
30 application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
31 application/pgp-encrypted) $EDITOR $fx ;;
32 *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;;
33 esac
34}}
35
36cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')"
37
38cmd extract ${{
39 clear; tput cup $(($(tput lines)/3)); tput bold
40 set -f
41 printf "%s\n\t" "$fx"
42 printf "extract?[y/N]"
43 read ans
44 [ $ans = "y" ] && aunpack $fx
45}}
46
47cmd delete ${{
48 clear; tput cup $(($(tput lines)/3)); tput bold
49 set -f
50 printf "%s\n\t" "$fx"
51 printf "delete?[y/N]"
52 read ans
53 [ $ans = "y" ] && rm -rf -- $fx
54}}
55
56cmd moveto ${{
57 clear; tput cup $(($(tput lines)/3)); tput bold
58 set -f
59 clear; echo "Move to where?"
60 dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" &&
61 for x in $fx; do
62 eval mv -iv \"$x\" \"$dest\"
63 done &&
64 notify-send "🚚 File(s) moved." "File(s) moved to $dest."
65}}
66
67cmd copyto ${{
68 clear; tput cup $(($(tput lines)/3)); tput bold
69 set -f
70 clear; echo "Copy to where?"
71 dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" &&
72 for x in $fx; do
73 eval cp -ivr \"$x\" \"$dest\"
74 done &&
75 notify-send "📋 File(s) copied." "File(s) copies to $dest."
76}}
77
78cmd setbg "$1"
79cmd bulkrename $vidir
80
81# Bindings
82map <c-f> $lf -remote "send $id select \"$(fzf)\""
83map J $lf -remote "send $id cd $(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)"
84map gh
85map g top
86map D delete
87map E extract
88map C copyto
89map M moveto
90map <c-n> push :mkdir<space>
91map <c-r> reload
92map <c-s> set hidden!
93map <enter> shell
94map x $$f
95map X !$f
96map o &mimeopen $f
97map O $mimeopen --ask $f
98
99map A rename # at the very end
100map c push A<c-u> # new rename
101map I push A<c-a> # at the very beginning
102map i push A<a-b><a-b><a-f> # before extension
103map a push A<a-b> # after extension
104map B bulkrename
105map b $setbg $f
106
107map <c-e> down
108map <c-y> up
109map V push :!nvim<space>
110
111map W $setsid -f $TERMINAL >/dev/null 2>&1
112
113map Y $printf "%s" "$fx" | xclip -selection clipboard
114
115# Source Bookmarks
116#source "~/.config/lf/shortcutrc"