summaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-07-02 22:26:56 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-07-02 22:26:56 +0900
commit976001e47459973b5e72565f3047cc9d9e20241d (patch)
treebf468b3e4b649995e48d6f87fc2c29edaceb0fa1 /man
parent531dd6fb4f8cbc981fbeb2a1649bbb5bb9e701a4 (diff)
downloadfzf-976001e47459973b5e72565f3047cc9d9e20241d.tar.gz
Explain the need to escape placeholders in transform actions
Diffstat (limited to 'man')
-rw-r--r--man/man1/fzf.111
1 files changed, 11 insertions, 0 deletions
diff --git a/man/man1/fzf.1 b/man/man1/fzf.1
index 0cf9f242..0802127e 100644
--- a/man/man1/fzf.1
+++ b/man/man1/fzf.1
@@ -1938,6 +1938,17 @@ e.g.
echo "change\-header:Invalid selection"'
\fR
+A common mistake when writing a \fBtransform\fR action is not escaping
+placeholder expressions when passing them back to fzf. In the following
+example, if you don't escape \fB{}\fR, fzf will immediately replace it with the
+single-quoted string of the current item. This causes single quotes to appear
+in the header and footer, and the script will break if any item contains
+double-quote characters.
+
+ \fBfzf \-\-bind 'focus:transform:[[ $FZF_ACTION =~ up ]] &&
+ echo "change\-header()+transform\-footer:echo \\{}" ||
+ echo "change\-footer()+transform\-header:echo \\{}"'\fR
+
.SS TRANSFORM IN THE BACKGROUND
Transform actions are synchronous, meaning fzf becomes unresponsive while the