summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Ablasou <alexherbo2@gmail.com>2020-10-21 15:22:10 +0200
committerMathieu Ablasou <alexherbo2@gmail.com>2020-10-21 15:55:51 +0200
commit60bcac481b71daf3f096a2b75e495af1631d7a1b (patch)
tree5b91aff790eca22ca1f02296186bfcb40c5aaf5a
parent4038539cf6e3b19bd4e435dd5181e91e64f06e0f (diff)
Add a :cat command
-rw-r--r--README.md8
-rwxr-xr-xrc/connect/commands/:cat7
2 files changed, 14 insertions, 1 deletions
diff --git a/README.md b/README.md
index f32607a..2c5f594 100644
--- a/README.md
+++ b/README.md
@@ -105,12 +105,18 @@ We just provide the nicety to have a `dolphin` command from Kakoune.
## Example 5
-**Terminal** – Render with [Glow] the current buffer:
+**Terminal** – Render with [Glow] the current file or buffer content:
``` sh
glow `:it`
```
+``` sh
+:cat | glow -
+```
+
+The latter outputs the buffer content, which is useful when the file is not saved.
+
[Glow]: https://github.com/charmbracelet/glow
### Example 6
diff --git a/rc/connect/commands/:cat b/rc/connect/commands/:cat
new file mode 100755
index 0000000..378a44a
--- /dev/null
+++ b/rc/connect/commands/:cat
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# Get the current buffer content.
+mkfifo buffer.fifo
+trap 'rm buffer.fifo' EXIT
+:send write buffer.fifo
+cat buffer.fifo