86 lines
1.8 KiB
Text
86 lines
1.8 KiB
Text
# enable icons
|
|
set icons
|
|
|
|
# enable image previews
|
|
set sixel true
|
|
set previewer ctpv
|
|
set cleaner ctpvclear
|
|
&ctpv -s $id
|
|
&ctpvquit $id
|
|
|
|
# show hidden files
|
|
set hidden true
|
|
|
|
set shell sh
|
|
set shellopts '-eu'
|
|
set ifs "\n"
|
|
|
|
set scrolloff 10
|
|
set cursorpreviewfmt "\033[7;2m"
|
|
set drawbox
|
|
|
|
# use enter for shell commands
|
|
map <enter> shell
|
|
|
|
# show the result of execution of previous commands
|
|
map ` !true
|
|
|
|
# execute current file (must be executable)
|
|
map x $$f
|
|
map X !$f
|
|
|
|
# dedicated keys for file opener actions
|
|
map o &mimeopen $f
|
|
map O $mimeopen --ask $f
|
|
|
|
# define a custom 'open' command
|
|
# This command is called when current file is not a directory. You may want to
|
|
# use either file extensions and/or mime types here. Below uses an editor for
|
|
# text files and a file opener for the rest.
|
|
cmd open &{{
|
|
case $(file --mime-type -Lb $f) in
|
|
text/*) lf -remote "send $id \$$EDITOR \$fx";;
|
|
*) for f in $fx; do $OPENER $f > /dev/null 2> /dev/null & done;;
|
|
esac
|
|
}}
|
|
|
|
# mkdir command. See wiki if you want it to select created dir
|
|
map a :push %mkdir<space>
|
|
|
|
# define a custom 'rename' command without prompt for overwrite
|
|
cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1
|
|
map r push :rename<space>
|
|
|
|
cmd delete ${{
|
|
set -f
|
|
printf "$fx\n"
|
|
printf "delete? [y/n] "
|
|
read ans
|
|
[ "$ans" = "y" ] && rm -rf $fx
|
|
}}
|
|
|
|
map <delete> delete
|
|
|
|
# extract the current file with the right command
|
|
# (xkcd link: https://xkcd.com/1168/)
|
|
cmd extract ${{
|
|
set -f
|
|
case $f in
|
|
*.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;;
|
|
esac
|
|
}}
|
|
|
|
map E extract
|
|
|
|
cmd mkexec ${{
|
|
chmod u+x $fx
|
|
printf "$fx is now executable"
|
|
}}
|
|
|
|
map V mkexec
|
|
|