diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2026-02-27 17:01:14 +0200 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2026-02-27 17:01:14 +0200 |
| commit | fe3aeacd3466beba2c9e777e02d4dc70e0ba3a2b (patch) | |
| tree | 9334bf9f3c662feabb6affe95e6c2ac394b0e8ef | |
| parent | 4b3105d47a0a5fd1e208d06409b53178099b346a (diff) | |
doc: nit
| -rw-r--r-- | config.h.in | 13 | ||||
| -rw-r--r-- | config_cmd.h.in | 16 |
2 files changed, 15 insertions, 14 deletions
diff --git a/config.h.in b/config.h.in index c330b0f..ae75fd6 100644 --- a/config.h.in +++ b/config.h.in @@ -126,18 +126,7 @@ #define RL_MAX (1 << 13) // -// Reserve room before and after marks for command and extra arguments. -// Marks are stored as an array of (char *) with the following layout: -// -// [DFM_MARK_CMD_PRE...][MARKS...][DFM_MARK_CMD_POST...][NULL] -// -// In order to run a command on marks dfm will simply write the caller's argv -// into the free slots in DFM_MARK_CMD_PRE. Similarly, there is space after the -// marks (DFM_MARK_CMD_PRE) where the caller can put arguments. Right now this -// POST location is only used to append a path to some commands. -// -// After writing the caller's argv, the marks array is simply passed as-is to -// exec. In other words, to call `rm -rf`, only two ptrs are copied +// Room to reserve before and after marks for commands. // #define DFM_MARK_CMD_PRE 32 #define DFM_MARK_CMD_POST 16 diff --git a/config_cmd.h.in b/config_cmd.h.in index bd12f0e..e1f5904 100644 --- a/config_cmd.h.in +++ b/config_cmd.h.in @@ -1,8 +1,8 @@ // // DFM - Dylan's File Manager - Configuration file. // -// Commands can be created using the FM_CMD macro which declares a function and -// fills in a struct fm_cmd. +// Commands can be created using the FM_CMD macro which declares a function +// that holds a struct fm_cmd and calls fm_cmd(). // // struct fm_cmd { // cut prompt; // Prompt text. @@ -26,6 +26,18 @@ // CMD_EXEC_MARK = Skip interactive prompt only if marks exist.. // CMD_EXEC_ROOT = Skip interactive prompt even if root. // +// 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. +// +// static void +// my_custom_fn(struct fm *p) +// { +// // Go wild. +// } +// +// Refer to dfm.c for more information. +// FM_CMD(cmd_exec, .prompt = CUT(":"), |