From 8f0c91545d308e534284b19edf61cbdb1ebbb315 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 29 Sep 2025 22:36:44 +0900 Subject: Add $FZF_RAW for conditional actions --- CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'CHANGELOG.md') diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ec86bf6..334b7f64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,22 @@ fzf --raw --color hidden:red:strikethrough fzf --raw --color hidden:regular:red:strikethrough ``` +#### Conditional actions for raw mode + +You may want to perform different actions depending on whether the current item +is a match or not. For that, fzf now exports `$FZF_RAW` environment variable. + +It's: + +- Undefined if raw mode is disabled +- `1` if the current item is a match +- `0` otherwise + +```sh +# Do not allow selecting non-matching items +fzf --raw --bind 'enter:transform:[[ ${FZF_RAW-1} = 1 ]] && echo accept || echo bell' +``` + #### Leveraging raw mode in shell integration The `CTRL-R` binding (command history) now lets you toggle raw mode with -- cgit v1.2.3