Krolyxon
Commit ba7303e

Branches

Refs →

dotfiles-x11.configlflfrc

114 lines · 3.1 KB

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