2023-05-24 13:55:32 -04:00
|
|
|
set drawbox
|
2023-05-14 05:06:12 -04:00
|
|
|
set icons true
|
|
|
|
set ignorecase true
|
|
|
|
|
|
|
|
# interpreter for shell commands
|
|
|
|
set shell sh
|
|
|
|
set shellopts '-eu'
|
|
|
|
|
|
|
|
set previewer ctpv
|
|
|
|
set cleaner ctpvclear
|
|
|
|
&ctpv -s $id
|
|
|
|
&ctpvquit $id
|
|
|
|
|
|
|
|
cmd edit-config ${{
|
2023-05-24 13:55:32 -04:00
|
|
|
$EDITOR ~/.config/lf/lfrc
|
|
|
|
lf -remote "send $id source ~/.config/lf/lfrc"
|
2023-05-14 05:06:12 -04:00
|
|
|
}}
|
|
|
|
|
2023-05-24 13:55:32 -04:00
|
|
|
cmd open &{{
|
|
|
|
case $(file --mime-type "$f" -bL) in
|
2023-07-10 06:53:13 -04:00
|
|
|
text/*|application/json) lf -remote "send $id \$$EDITOR \"$fx\"";;
|
2023-05-24 13:55:32 -04:00
|
|
|
image/*) swayimg -f "$f";;
|
|
|
|
audio/*) lf -remote "send $id \$mpv --audio-display=no \"$fx\" && clear";;
|
|
|
|
video/*) mpv "$f";;
|
|
|
|
application/pdf|application/epub) zathura "$f";;
|
2023-07-10 06:53:13 -04:00
|
|
|
*) xdg-open "$f";;
|
2023-05-24 13:55:32 -04:00
|
|
|
esac
|
2023-05-14 05:06:12 -04:00
|
|
|
}}
|
|
|
|
|
|
|
|
cmd setwallpaper %swww img "$f" --transition-type right --transition-fps 60
|
|
|
|
|
|
|
|
cmd fzf_jump ${{
|
2023-05-24 13:55:32 -04:00
|
|
|
res="$(find . | fzf --reverse --header='Jump to location' | sed 's/\\/\\\\/g;s/"/\\"/g')"
|
|
|
|
if [ -d "$res" ] ; then
|
|
|
|
cmd="cd"
|
|
|
|
elif [ -f "$res" ] ; then
|
|
|
|
cmd="select"
|
|
|
|
else
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
lf -remote "send $id $cmd \"$res\""
|
2023-05-14 05:06:12 -04:00
|
|
|
}}
|
|
|
|
|
|
|
|
cmd fzf_search ${{
|
2023-05-24 13:55:32 -04:00
|
|
|
res="$( \
|
|
|
|
RG_PREFIX="rg --column --line-number --no-heading --color=always \
|
|
|
|
--smart-case "
|
|
|
|
FZF_DEFAULT_COMMAND="$RG_PREFIX ''" \
|
|
|
|
fzf --bind "change:reload:$RG_PREFIX {q} || true" \
|
|
|
|
--ansi --layout=reverse --header 'Search in files' \
|
|
|
|
| cut -d':' -f1
|
|
|
|
)"
|
|
|
|
[ ! -z "$res" ] && lf -remote "send $id select \"$res\""
|
2023-05-14 05:06:12 -04:00
|
|
|
}}
|
|
|
|
|
|
|
|
cmd unarchive ${{
|
2023-05-24 13:55:32 -04:00
|
|
|
set -f
|
|
|
|
case $f in
|
2023-07-10 06:53:13 -04:00
|
|
|
*.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf "$f";;
|
|
|
|
*.tar.gz|*.tgz) tar xzvf "$f";;
|
|
|
|
*.tar.xz|*.txz) tar xJvf "$f";;
|
|
|
|
*.zip) unzip "$f";;
|
|
|
|
*.rar) unrar x "$f";;
|
|
|
|
*.7z) 7z x "$f";;
|
2023-05-24 13:55:32 -04:00
|
|
|
esac
|
2023-05-14 05:06:12 -04:00
|
|
|
}}
|
|
|
|
|
|
|
|
cmd tar ${{
|
2023-05-24 13:55:32 -04:00
|
|
|
set -f
|
|
|
|
mkdir $1
|
|
|
|
cp -r $fx $1
|
|
|
|
tar czf $1.tar.gz $1
|
|
|
|
rm -rf $1
|
2023-05-14 05:06:12 -04:00
|
|
|
}}
|
|
|
|
|
|
|
|
cmd zip ${{
|
2023-05-24 13:55:32 -04:00
|
|
|
set -f
|
|
|
|
mkdir $1
|
|
|
|
cp -r $fx $1
|
|
|
|
zip -r $1.zip $1
|
|
|
|
rm -rf $1
|
2023-05-14 05:06:12 -04:00
|
|
|
}}
|
|
|
|
|
|
|
|
|
|
|
|
# Trash bindings
|
|
|
|
cmd trash ${{
|
|
|
|
files=$(printf "$fx" | tr '\n' ';')
|
|
|
|
while [ "$files" ]; do
|
|
|
|
file=${files%%;*}
|
2023-05-24 13:55:32 -04:00
|
|
|
|
|
|
|
if [[ "$(pwd)" == "/home/$USER/.local/share/Trash/files" ]]; then
|
2023-07-10 06:53:13 -04:00
|
|
|
rm -rf "$fx"
|
2023-05-24 13:55:32 -04:00
|
|
|
else
|
|
|
|
trash-put "$(basename "$file")"
|
|
|
|
fi
|
2023-05-14 05:06:12 -04:00
|
|
|
|
|
|
|
if [ "$files" = "$file" ]; then
|
|
|
|
files=''
|
|
|
|
else
|
|
|
|
files="${files#*;}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}}
|
|
|
|
|
2023-07-10 06:53:13 -04:00
|
|
|
# cmd trash ${{
|
|
|
|
# files=$(printf "$fx" | tr '\n' ';')
|
|
|
|
# while [ "$files" ]; do
|
|
|
|
# file=${files%%;*}
|
|
|
|
# if [[ $PWD == "$HOME/.local/share/Trash/files" ]]; then
|
|
|
|
# rm -rf "$file"
|
|
|
|
# else
|
|
|
|
# trash-put "$(basename "$filename")"
|
|
|
|
# fi
|
|
|
|
#
|
|
|
|
# if [ "$files" = "$file" ]; then
|
|
|
|
# files=''
|
|
|
|
# else
|
|
|
|
# files="${files#*;}"
|
|
|
|
# fi
|
|
|
|
# done
|
|
|
|
# }}
|
|
|
|
|
2023-05-24 13:55:32 -04:00
|
|
|
# lfrc
|
|
|
|
cmd restore-from-trash ${{
|
|
|
|
ids="$(echo -ne '\n' | \
|
|
|
|
trash-restore | \
|
|
|
|
awk '$1 ~ /^[0-9]+/ {print $0}' | \
|
|
|
|
fzf --multi | \
|
|
|
|
awk '{print $1}' | \
|
|
|
|
sed -z 's/\n/,/g;s/,$/\n/')"
|
|
|
|
echo $ids | trash-restore
|
|
|
|
clear
|
2023-05-14 05:06:12 -04:00
|
|
|
}}
|
|
|
|
|
2023-05-24 13:55:32 -04:00
|
|
|
map m
|
|
|
|
map o
|
|
|
|
map n
|
|
|
|
map "'"
|
|
|
|
map '"'
|
|
|
|
map d
|
|
|
|
map e
|
|
|
|
map f
|
|
|
|
map t
|
2023-07-10 06:53:13 -04:00
|
|
|
map u
|
|
|
|
map a
|
|
|
|
|
|
|
|
map ua unarchive
|
2023-05-14 05:06:12 -04:00
|
|
|
|
2023-05-24 13:55:32 -04:00
|
|
|
map . set hidden!
|
2023-05-14 05:06:12 -04:00
|
|
|
|
2023-05-24 13:55:32 -04:00
|
|
|
map md push %mkdir<space>
|
2023-07-10 06:53:13 -04:00
|
|
|
map gp jump-prev
|
2023-05-14 05:06:12 -04:00
|
|
|
|
|
|
|
map y copy
|
|
|
|
map p paste
|
|
|
|
map x cut
|
|
|
|
|
2023-05-24 13:55:32 -04:00
|
|
|
map <enter> open
|
|
|
|
|
2023-05-14 05:06:12 -04:00
|
|
|
map f :fzf_jump
|
|
|
|
map gf :fzf_search
|
|
|
|
|
2023-05-24 13:55:32 -04:00
|
|
|
map C edit-config
|
|
|
|
map bg setwallpaper
|
2023-05-14 05:06:12 -04:00
|
|
|
|
2023-05-24 13:55:32 -04:00
|
|
|
map dd trash
|
|
|
|
map dr restore-from-trash
|
2023-05-14 05:06:12 -04:00
|
|
|
|
2023-05-24 13:55:32 -04:00
|
|
|
map R reload
|
2023-05-14 05:06:12 -04:00
|
|
|
|
|
|
|
map gh cd ~
|
|
|
|
map gd cd ~/Downloads
|
|
|
|
map gD cd ~/Documents
|
|
|
|
|
|
|
|
map gc cd ~/.config
|
|
|
|
map gr cd ~/repos
|
|
|
|
|
2023-05-24 13:55:32 -04:00
|
|
|
map gC cd ~/code
|
|
|
|
|
2023-05-14 05:06:12 -04:00
|
|
|
map gp cd ~/Pictures
|
|
|
|
map gw cd ~/Pictures/wallpapers
|
|
|
|
map gs cd ~/Pictures/screenshots
|
|
|
|
|
|
|
|
map gv cd ~/Videos
|
|
|
|
map gm cd ~/Music
|
2023-07-10 06:53:13 -04:00
|
|
|
map gA cd ~/Anime
|
2023-05-14 05:06:12 -04:00
|
|
|
|
|
|
|
map gt cd ~/.local/share/Trash/files
|
2023-05-24 13:55:32 -04:00
|
|
|
map tc %rm -rf ~/.local/share/Trash/files/*
|