commit 6e61c083c292501685712881d8ca4210e49faaa9
parent b40a5db7870c06ac02a7040d35ec1a1d91e3adeb
Author: Alex Balgavy <alex@balgavy.eu>
Date: Mon, 11 Jan 2021 23:56:51 +0100
lf: change command to substitute in filename
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lf/lfrc b/lf/lfrc
@@ -1,4 +1,4 @@
-# vim: foldmethod=marker foldlevel=0
+# vim: foldmethod=marker foldlevel=0 filetype=lfrc
# General settings {{{
# interpreter for shell commands (needs to be POSIX compatible)
set shell bash
@@ -44,6 +44,12 @@ cmd open $opener $fx
# define a custom 'rename' command without prompt for overwrite
cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1
+cmd change %{{
+ printf "Substitute: "
+ read -r sedcmd
+ mv "$f" "$(dirname "$f")/$(printf '%s' "$(basename "$f")" | sed "s$sedcmd")"
+}}
+
# queue an audio file in mpd
cmd queue %{{
for i in $fx; do
@@ -251,6 +257,7 @@ map g?
map g? $lf -doc | $PAGER; clear
map R push :rename<space>
+map C change
map cw push :rename<space>
map E $$EDITOR $fx
map D trash