voidrice/.config/lf/lfrc

139 lines
4.8 KiB
Text
Raw Normal View History

2019-05-24 02:59:30 +00:00
# Luke's lf settings
2022-03-11 23:32:19 +00:00
# Note on Image Previews
# For those wanting image previews, like this system, there are four steps to
# set it up. These are done automatically for LARBS users, but I will state
# them here for others doing it manually.
#
# 1. ueberzug must be installed.
# 2. The scope file (~/.config/lf/scope for me), must have a command similar to
# mine to generate ueberzug images.
# 3. A `set cleaner` line as below is a cleaner script.
# 4. lf should be started through a wrapper script (~/.local/bin/lfub for me)
2022-03-11 23:32:19 +00:00
# that creates the environment for ueberzug. This command can be be aliased
# in your shellrc (`alias lf="lfub") or if set to a binding, should be
# called directly instead of normal lf.
2019-05-24 02:59:30 +00:00
# Basic vars
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"
2022-03-11 23:32:19 +00:00
set cleaner '~/.config/lf/cleaner'
set previewer '~/.config/lf/scope'
2022-09-28 01:32:47 +00:00
set autoquit on
2019-05-24 02:59:30 +00:00
# cmds/functions
cmd open ${{
case $(file --mime-type "$(readlink -f $f)" -b) in
2022-03-06 18:19:51 +00:00
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;;
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 ;;
2022-03-06 18:19:51 +00:00
text/*|application/json|inode/x-empty) $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 ;;
2022-03-11 23:32:19 +00:00
image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" |
setsid -f sxiv -aio 2>/dev/null | while read -r file; do
[ -z "$file" ] && continue
lf -remote "send select \"$file\""
lf -remote "send toggle"
done &
;;
2020-05-27 19:54:16 +00:00
audio/*) mpv --audio-display=no $f ;;
2022-11-16 16:23:03 +00:00
video/*|application/vnd.rn-realmedia) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
application/pdf|application/vnd.djvu|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
2021-05-31 00:55:28 +00:00
application/pgp-encrypted) $EDITOR $fx ;;
2022-08-05 12:38:22 +00:00
application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text) setsid -f lowriter $fx >/dev/null 2>&1 ;;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template) setsid -f localc $fx >/dev/null 2>&1 ;;
application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint) setsid -f loimpress $fx >/dev/null 2>&1 ;;
application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template) setsid -f lodraw $fx >/dev/null 2>&1 ;;
application/vnd.oasis.opendocument.formula) setsid -f lomath $fx >/dev/null 2>&1 ;;
application/vnd.oasis.opendocument.database) setsid -f lobase $fx >/dev/null 2>&1 ;;
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
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
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
2022-03-06 18:19:51 +00:00
map Y $printf "%s" "$fx" | xclip -selection clipboard
# Source Bookmarks
2021-08-25 12:02:39 +00:00
source "~/.config/lf/shortcutrc"