aboutsummaryrefslogtreecommitdiff
path: root/config_cmd.h.in
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2026-02-28 21:52:26 +0200
committerDylan Araps <dylan.araps@gmail.com>2026-02-28 21:52:26 +0200
commit67a1c24a8661fdcbc48f72f7b65521772065d305 (patch)
tree33c1fbfe2452c23773de046b1127f4920aa5a49f /config_cmd.h.in
parent4fb29c95c61256f78e4b501a3c550b4c92a92a4e (diff)
dfm: add ranger style bulk rename
Also the ability to embed scripts within dfm.
Diffstat (limited to 'config_cmd.h.in')
-rw-r--r--config_cmd.h.in33
1 files changed, 32 insertions, 1 deletions
diff --git a/config_cmd.h.in b/config_cmd.h.in
index 5891957..3802760 100644
--- a/config_cmd.h.in
+++ b/config_cmd.h.in
@@ -25,7 +25,31 @@
// CMD_FILE_CURSOR = Ignore marks and add the name under the cursor to input.
// CMD_EXEC_MARK = Skip interactive prompt only if marks exist..
// CMD_EXEC_ROOT = Skip interactive prompt even if root.
-//
+!!
+## Shell cript can be embedded within dfm by using the embed command.
+## The script will be run in $SHELL as the argument following '-c'.
+##
+## FM_CMD(cmd_bulk_rename,
+## .prompt = CUT_NULL,
+## .left = CUT($(embed script/bulk-rename)),
+## .enter = fm_cmd_run_sh,
+## .config = CMD_MARK_DIR | CMD_MUT | CMD_EXEC,
+## )
+##
+## Another useful example is embedding your opener script.
+##
+## FM_CMD(cmd_opener,
+## .prompt = CUT_NULL,
+## .left = CUT($(embed script/opener_ext)),
+## .enter = fm_cmd_run_sh,
+## .config = CMD_MARK_DIR | CMD_EXEC,
+## )
+##
+## Shell can also be typed directly but its cumbersone to add \\n to the end of
+## each line and escape backslashes and double quotes.
+##
+## .left = CUT("echo \\"$@\\"\\n"),
+!!
// If the FM_CMD system is too limiting you can define your own functions and
// bind them to keys. The same function signature is used in navigation and
// input modes.
@@ -154,3 +178,10 @@ FM_CMD(cmd_trash,
.config = CMD_MARK_DIR | CMD_MUT | CMD_EXEC_MARK,
)
+FM_CMD(cmd_bulk_rename,
+ .prompt = CUT_NULL,
+ .left = CUT($(embed script/bulk-rename)),
+ .enter = fm_cmd_run_sh,
+ .config = CMD_MARK_DIR | CMD_MUT | CMD_EXEC,
+)
+