2019-05-24 02:59:30 +00:00
|
|
|
# Luke's lf settings
|
|
|
|
|
|
|
|
# Basic vars
|
2020-04-10 12:00:42 +00:00
|
|
|
set shell bash
|
2019-05-24 02:59:30 +00:00
|
|
|
set shellopts '-eu'
|
|
|
|
set ifs "\n"
|
|
|
|
set scrolloff 10
|
2020-04-10 12:00:42 +00:00
|
|
|
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
|
|
|
|
2020-04-10 20:39:32 +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 $f -b) in
|
2020-05-30 21:01:18 +00:00
|
|
|
image/vnd.djvu|application/pdf|application/octet-stream) 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\)*$" | sxiv -aio 2>/dev/null | lf-select ;;
|
2020-05-27 19:54:16 +00:00
|
|
|
audio/*) mpv --audio-display=no $f ;;
|
2020-05-30 21:01:18 +00:00
|
|
|
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
|
|
|
|
}}
|
|
|
|
|
2020-04-10 12:00:42 +00:00
|
|
|
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" ] && ext $fx
|
|
|
|
}}
|
|
|
|
|
2019-05-24 02:59:30 +00:00
|
|
|
cmd delete ${{
|
2020-04-10 12:00:42 +00:00
|
|
|
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 ${{
|
2020-04-10 12:00:42 +00:00
|
|
|
clear; tput cup $(($(tput lines)/3)); tput bold
|
2019-05-24 02:59:30 +00:00
|
|
|
set -f
|
|
|
|
clear; echo "Move to where?"
|
2021-08-31 13:28:33 +00:00
|
|
|
dest="$(awk '{ gsub(/#.*/, ""); } !/^$/ { print $2 }' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)" &&
|
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 ${{
|
2020-04-10 12:00:42 +00:00
|
|
|
clear; tput cup $(($(tput lines)/3)); tput bold
|
2019-05-24 02:59:30 +00:00
|
|
|
set -f
|
|
|
|
clear; echo "Copy to where?"
|
2021-08-31 13:28:33 +00:00
|
|
|
dest="$(awk '{ gsub(/#.*/, ""); } !/^$/ { print $2 }' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)" &&
|
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
|
2020-07-16 04:29:04 +00:00
|
|
|
|
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-08-31 13:28:33 +00:00
|
|
|
map J $lf -remote "send $id cd $(awk '{ gsub(/#.*/, ""); } !/^$/ { print $2 }' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed "s/\${.*-// ; s/}//" | envsubst)"
|
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
|
2020-04-10 12:00:42 +00:00
|
|
|
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
|
2020-04-10 12:00:42 +00:00
|
|
|
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
|
|
|
|
map i push A<a-b><a-b><a-f> # before extention
|
|
|
|
map a push A<a-b> # after extention
|
2020-07-16 04:29:04 +00:00
|
|
|
map B bulkrename
|
2020-07-16 12:27:28 +00:00
|
|
|
map b $setbg $f
|
2020-04-10 12:00:42 +00:00
|
|
|
|
|
|
|
map <c-e> down
|
|
|
|
map <c-y> up
|
|
|
|
map V push :!nvim<space>
|
2021-04-06 18:52:18 +00:00
|
|
|
|
|
|
|
# Source Bookmarks
|
2021-08-25 12:02:39 +00:00
|
|
|
source "~/.config/lf/shortcutrc"
|