voidrice/.config/lf/lfrc

110 lines
2.9 KiB
Text
Raw Normal View History

2019-05-24 02:59:30 +00:00
# Luke's lf settings
# Basic vars
set shell bash
2019-05-24 02:59:30 +00:00
set shellopts '-eu'
set ifs "\n"
set scrolloff 10
set icons
set period 1
2020-07-10 18:20:01 +00:00
set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml"
2019-05-24 02:59:30 +00:00
# Vars that depend on environmental variables
$lf -remote "send $id set previewer ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope"
2019-05-24 02:59:30 +00:00
# cmds/functions
cmd open ${{
case $(file --mime-type "$(readlink -f $f)" -b) in
2021-11-12 22:02:41 +00:00
image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;;
2019-05-24 02:59:30 +00:00
text/*) $EDITOR $fx;;
2020-12-26 14:38:52 +00:00
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\)*$" | setsid -f sxiv -aio 2>/dev/null | lf-select & ;;
2020-05-27 19:54:16 +00:00
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 ;;
2021-05-31 00:55:28 +00:00
application/pgp-encrypted) $EDITOR $fx ;;
2020-05-31 00:49:55 +00:00
*) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;;
2019-05-24 02:59:30 +00:00
esac
}}
cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')"
2019-05-24 02:59:30 +00:00
2021-03-30 01:32:42 +00:00
cmd extract ${{
clear; tput cup $(($(tput lines)/3)); tput bold
set -f
printf "%s\n\t" "$fx"
printf "extract?[y/N]"
read ans
[ $ans = "y" ] && aunpack $fx
2021-03-30 01:32:42 +00:00
}}
2019-05-24 02:59:30 +00:00
cmd delete ${{
clear; tput cup $(($(tput lines)/3)); tput bold
2019-05-24 02:59:30 +00:00
set -f
printf "%s\n\t" "$fx"
2019-09-23 10:14:33 +00:00
printf "delete?[y/N]"
2019-05-24 02:59:30 +00:00
read ans
2020-12-26 14:38:52 +00:00
[ $ans = "y" ] && rm -rf -- $fx
2019-05-24 02:59:30 +00:00
}}
cmd moveto ${{
clear; tput cup $(($(tput lines)/3)); tput bold
2019-05-24 02:59:30 +00:00
set -f
clear; echo "Move to where?"
2021-11-12 22:02:41 +00:00
dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" &&
2020-05-27 19:54:16 +00:00
for x in $fx; do
eval mv -iv \"$x\" \"$dest\"
done &&
2019-05-24 02:59:30 +00:00
notify-send "🚚 File(s) moved." "File(s) moved to $dest."
}}
cmd copyto ${{
clear; tput cup $(($(tput lines)/3)); tput bold
2019-05-24 02:59:30 +00:00
set -f
clear; echo "Copy to where?"
2021-11-12 22:02:41 +00:00
dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" &&
2020-05-27 19:54:16 +00:00
for x in $fx; do
eval cp -ivr \"$x\" \"$dest\"
done &&
2019-05-24 02:59:30 +00:00
notify-send "📋 File(s) copied." "File(s) copies to $dest."
}}
2020-07-16 12:27:28 +00:00
cmd setbg "$1"
cmd bulkrename $vidir
2019-05-24 02:59:30 +00:00
# Bindings
2019-09-23 10:14:33 +00:00
map <c-f> $lf -remote "send $id select '$(fzf)'"
2021-11-12 22:02:41 +00:00
map 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)"
2019-05-24 02:59:30 +00:00
map gh
map g top
map D delete
2021-03-30 01:32:42 +00:00
map E extract
2019-05-24 02:59:30 +00:00
map C copyto
map M moveto
map <c-n> push :mkdir<space>
2019-09-23 10:14:33 +00:00
map <c-r> reload
2021-03-30 01:32:42 +00:00
map <c-s> set hidden!
2019-05-24 02:59:30 +00:00
map <enter> shell
map x $$f
map X !$f
map o &mimeopen $f
map O $mimeopen --ask $f
map A rename # at the very end
map c push A<c-u> # new rename
map I push A<c-a> # at the very beginning
2022-01-26 15:07:42 +00:00
map i push A<a-b><a-b><a-f> # before extension
map a push A<a-b> # after extension
map B bulkrename
2020-07-16 12:27:28 +00:00
map b $setbg $f
map <c-e> down
map <c-y> up
map V push :!nvim<space>
2021-09-23 15:30:23 +00:00
map W $setsid -f $TERMINAL >/dev/null 2>&1
# Source Bookmarks
2021-08-25 12:02:39 +00:00
source "~/.config/lf/shortcutrc"