aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/foot.1.scd32
-rw-r--r--doc/foot.ini.5.scd22
2 files changed, 47 insertions, 7 deletions
diff --git a/doc/foot.1.scd b/doc/foot.1.scd
index 385f9721..8e2fb313 100644
--- a/doc/foot.1.scd
+++ b/doc/foot.1.scd
@@ -424,6 +424,38 @@ See the wiki
(https://codeberg.org/dnkl/foot/wiki#user-content-jumping-between-prompts)
for details, and examples for other shells.
+## Piping last command’s output
+
+The key binding *pipe-command-output* can pipe the last command’s
+output to an application of your choice (similar to the other
+*pipe-\** key bindings):
+
+ *\[key-bindings\]++
+pipe-command-output=[sh -c "f=$(mktemp); cat - > $f; footclient emacsclient -nw $f; rm $f"] Control+Shift+g*
+
+When pressing *ctrl*+*shift*+*g*, the last command’s output is written
+to a temporary file, then an emacsclient is started in a new
+footclient instance. The temporary file is removed after the
+footclient instance has closed.
+
+For this to work, the shell must emit an OSC-133;C (*\\E]133;C\\E\\\\*)
+sequence before command output starts, and an OSC-133;D
+(*\\E]133;D\\E\\\\*) when the command output ends.
+
+In fish, one way to do this is to add _preexec_ and _postexec_ hooks:
+
+ *function foot_cmd_start --on-event fish_preexec
+ echo -en "\\e]133;C\\e\\\\"
+ end*
+
+ *function foot_cmd_end --on-event fish_postexec
+ echo -en "\\e]133;D\\e\\\\"
+ end*
+
+See the wiki
+(https://codeberg.org/dnkl/foot/wiki#user-content-piping-last-commands-output)
+for details, and examples for other shells
+
# TERMINFO
Client applications use the terminfo identifier specified by the
diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd
index 1c87db53..14999a8b 100644
--- a/doc/foot.ini.5.scd
+++ b/doc/foot.ini.5.scd
@@ -844,11 +844,12 @@ e.g. *search-start=none*.
*fullscreen*
Toggles the fullscreen state. Default: _none_.
-*pipe-visible*, *pipe-scrollback*, *pipe-selected*
- Pipes the currently visible text, the entire scrollback, or the
- currently selected text to an external tool. The syntax for this
- option is a bit special; the first part of the value is the
- command to execute enclosed in "[]", followed by the binding(s).
+*pipe-visible*, *pipe-scrollback*, *pipe-selected*, *pipe-command-output*
+ Pipes the currently visible text, the entire scrollback, the
+ currently selected text, or the last command's output to an
+ external tool. The syntax for this option is a bit special; the
+ first part of the value is the command to execute enclosed in
+ "[]", followed by the binding(s).
You can configure multiple pipes as long as the command strings
are different and the key bindings are unique.
@@ -856,10 +857,17 @@ e.g. *search-start=none*.
Note that the command is *not* automatically run inside a shell;
use *sh -c "command line"* if you need that.
- Example:
- *pipe-visible=[sh -c "xurls | uniq | tac | fuzzel | xargs -r
+ Example #1:
+
+ # Extract currently visible URLs, let user choose one (via
+ fuzzel), then launch firefox with the selected URL++
+*pipe-visible=[sh -c "xurls | uniq | tac | fuzzel | xargs -r
firefox"] Control+Print*
+ Example #2:
+ # Write scrollback content to /tmp/foot-scrollback.txt++
+*pipe-scrollback=[sh -c "cat - > /tmp/foot-scrollback.txt"]
+ Control+Shift+Print*
Default: _none_
*show-urls-launch*