commit 320c4171ee0e9c464c8766202f69213382f88849
parent 380de7cabe54dacfb7cdb9a5172c52399d700703
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date: Mon, 17 Nov 2025 00:08:53 +0530
Update plugin docs for floating window usage
Diffstat:
3 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/nnn.1 b/nnn.1
@@ -505,6 +505,15 @@ separated by \fB;\fR:
export NNN_PLUG='m:-!|mediainfo "$nnn";t:-!|tree -ps;l:-!|ls -lah --group-directories-first'
+ 8. To show the output of run-and-exit commands in a floating window,
+ add \fB>\fR (right arrow) after \fB!\fR
+ Note: This option is incompatible with \fB&\fR (terminal output is masked
+ for GUI programs) and ignores \fB*\fR (output is rendered in a floating
+ window).
+ Option `-` is ignored with this option. The directory is always refreshed.
+
+ export NNN_PLUG='m:!>mediainfo "$nnn";t:!>tree -ps;l:!>ls -lah --group-directories-first'
+
EXAMPLES:
------------------------------------ + -------------------------------------------------
Key:Command | Description
diff --git a/plugins/README.md b/plugins/README.md
@@ -189,6 +189,17 @@ Notes:
3. (_Again_) add `!` before the command
4. To disable directory refresh after running a _command as plugin_, prefix with `-!`
+#### Non-interactive command output in a floating window [`>`]
+
+To show the output of run-and-exit commands in a floating window, add `>` (right arrow) after `!`.
+
+```sh
+export NNN_PLUG='m:!>mediainfo "$nnn";t:!>tree -ps;l:!>ls -lah --group-directories-first'
+```
+
+This option is incompatible with `&` (terminal output is masked for GUI programs) and ignores `*` (output is rendered in a floating window).
+Option `-` is ignored with this option. The directory is always refreshed.
+
#### Some useful key-command examples
| Key:Command | Description |
@@ -374,7 +385,7 @@ fi
#### Change directory
- NNN_PLUG='c:!read -r to && [ -n "$to" ] && printf "0c%s" "${to}" > "$NNN_PIPE"*'
+ NNN_PLUG='c:!read -p "full path: " -r to && [ -n "$to" ] && printf "0c%s" "${to}" > "$NNN_PIPE"*'
## Contributing plugins
diff --git a/src/nnn.c b/src/nnn.c
@@ -5759,9 +5759,9 @@ static void run_cmd_as_plugin(const char *file, ushort_t flags, enum action *act
else if (flags & F_WINDOW) {
char *content = NULL;
size_t content_len = 0;
- char * const cmds[] = { g_buf, };
+ char * const cmds[] = { utils[UTIL_SH_EXEC], };
- if (buffer_command_output(cmds, NULL, NULL, ELEMENTS(cmds), &content, &content_len))
+ if (buffer_command_output(cmds, g_buf, NULL, ELEMENTS(cmds), &content, &content_len))
show_content_in_floating_window(content, content_len, action);
free(content);
} else