summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2023-12-26 12:20:27 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2023-12-26 12:21:06 +0900
commitc4df0dd06e69c9fad90e88ae7f6fbb5d8426077e (patch)
tree4a6e7ff3bfbc500ca325b0fe6b980aa5e2394c2e
parentcd114c6818d4881173bd7b43cd26ffe803d31a1c (diff)
Add TRANSFORM ACTIONS section to man page
-rw-r--r--CHANGELOG.md4
-rw-r--r--man/man1/fzf.123
2 files changed, 25 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bb986dee..f46d0f08 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,12 +7,12 @@ CHANGELOG
```sh
# Disallow selecting an empty line
echo -e "1. Hello\n2. Goodbye\n\n3. Exit" |
- fzf --reverse --header 'Select one' \
+ fzf --height '~100%' --reverse --header 'Select one' \
--bind 'enter:transform:[[ -n {} ]] && echo accept || echo "change-header:Invalid selection"'
# Move cursor past the empty line
echo -e "1. Hello\n2. Goodbye\n\n3. Exit" |
- fzf --reverse --header 'Select one' \
+ fzf --height '~100%' --reverse --header 'Select one' \
--bind 'enter:transform:[[ -n {} ]] && echo accept || echo "change-header:Invalid selection"' \
--bind 'focus:transform:[[ -n {} ]] && exit; [[ {fzf:action} =~ up$ ]] && echo up || echo down'
```
diff --git a/man/man1/fzf.1 b/man/man1/fzf.1
index 20e7e17d..fd68a874 100644
--- a/man/man1/fzf.1
+++ b/man/man1/fzf.1
@@ -1221,6 +1221,7 @@ A key or an event can be bound to one or more of the following actions.
\fBtoggle-track\fR
\fBtoggle+up\fR \fIbtab (shift-tab)\fR
\fBtrack\fR (track the current item; automatically disabled if focus changes)
+ \fBtransform(...)\fR (transform states using the output of an external command)
\fBtransform-border-label(...)\fR (transform border label using an external command)
\fBtransform-header(...)\fR (transform header using an external command)
\fBtransform-preview-label(...)\fR (transform preview label using an external command)
@@ -1333,6 +1334,28 @@ e.g.
\fB# You can still filter and select entries from the initial list for 3 seconds
seq 100 | fzf --bind 'load:reload-sync(sleep 3; seq 1000)+unbind(load)'\fR
+.SS TRANSFORM ACTIONS
+
+Actions with \fBtransform-\fR prefix are used to transform the states of fzf
+using the output of an external command. The output of these commands are
+expected to be a single line of text.
+
+e.g.
+ \fBfzf --bind 'focus:transform-header:file --brief {}'\fR
+
+\fBtransform(...)\fR action runs an external command that should print a series
+of actions to be performed. The output should be in the same format as the
+payload of HTTP POST request to the \fB--listen\fR server.
+
+e.g.
+ \fB# Disallow selecting an empty line
+ echo -e "1. Hello\\n2. Goodbye\\n\\n3. Exit" |
+ fzf --height '~100%' --reverse --header 'Select one' \\
+ --bind 'enter:transform:[[ -n {} ]] &&
+ echo accept ||
+ echo "change-header:Invalid selection"'
+ \fR
+
.SS PREVIEW BINDING
With \fBpreview(...)\fR action, you can specify multiple different preview