From 60bcac481b71daf3f096a2b75e495af1631d7a1b Mon Sep 17 00:00:00 2001 From: Mathieu Ablasou Date: Wed, 21 Oct 2020 15:22:10 +0200 Subject: Add a :cat command --- README.md | 8 +++++++- rc/connect/commands/:cat | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100755 rc/connect/commands/:cat 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 -- cgit v1.2.3