Refactor lfrc and add keybindings/cmds

This commit is contained in:
daniele 2024-04-06 19:49:20 +02:00
parent b149711453
commit 0a100f4c22
Signed by: fuxino
GPG Key ID: 981A2B2A3BBF5514

View File

@ -26,26 +26,6 @@ set cursorpreviewfmt "\033[7;2m"
# Use icons
set icons
map gc cd ~/.config
map gd cd ~/Development
map gv cd ~/Videos
map gm cd ~/Music
map gp cd ~/Pictures
# 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
@ -57,20 +37,6 @@ cmd open &{{
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>
# make sure trash folder exists
# %mkdir -p ~/.trash
# move current file or selected files to trash folder
# (also see 'man mv' for backup/overwrite options)
cmd trash %set -f; mv $fx ~/.trash
# define a custom 'delete' command
# cmd delete ${{
# set -f
@ -80,10 +46,6 @@ cmd trash %set -f; mv $fx ~/.trash
# [ "$ans" = "y" ] && rm -rf $fx
# }}
# use '<delete>' key for either 'trash' or 'delete' command
# map <delete> trash
# map <delete> delete
# extract the current file with the right command
# (xkcd link: https://xkcd.com/1168/)
cmd extract ${{
@ -115,3 +77,83 @@ cmd zip ${{
zip -r $1.zip $1
rm -rf $1
}}
# custom commands
#
# files and dirs
cmd mkdir ${{
printf "Directory name: "
read ans
mkdir $ans
}}
cmd mkfile ${{
printf "File name: "
read ans
touch $ans
}}
# trash management
cmd trash ${{
files=$(printf "$fx" | tr '\n' ';')
while [ "$files" ]; do
file=${files%%;*}
trash-put "$(basename "$file")"
if [ "$files" = "$file" ]; then
files=""
else
files="${files#*;}"
fi
done
}}
cmd trash-clear %trash-empty
cmd trash-restore ${{
trash-restore
}}
# keybindings
#
# remove some defaults
map m
map d
map t
# 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
# custom keybindings
#
# goto directory
map gc cd ~/.config
map gd cd ~/Development
map gv cd ~/Videos
map gm cd ~/Music
map gp cd ~/Pictures
map ga cd /run/user/1000/gvfs
# archives
map ax extract
map at tar
map az zip
# files and dirs
map md mkdir
map mf mkfile
map dc cut
# trash
map dd trash
map tc trash-clear
map tr trash-restore