summaryrefslogtreecommitdiffstats
path: root/CHANGELOG.md
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2024-01-16 14:17:56 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2024-01-16 14:18:31 +0900
commitcdfaf761df2e68503ca7c74c0aaa3e6fa4a46bda (patch)
treed12ef3ad5a0f20b0f8a462967afb026dd04615bc /CHANGELOG.md
parent1a9ea6f738cfafab83a5e0e828e60f0bf68bffee (diff)
Expose state information via environment variables to child processes
Close #3582
Diffstat (limited to 'CHANGELOG.md')
-rw-r--r--CHANGELOG.md27
1 files changed, 27 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c7e54342..f66e0a09 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,33 @@ CHANGELOG
0.46.0 (WIP)
------
- Added `result` event that is triggered when the filtering for the current query is complete and the result list is ready.
+- fzf now exports the following environment variables to the child processes
+ | Variable | Description |
+ | --- | --- |
+ | `FZF_LINES` | Number of lines fzf takes up excluding padding and margin |
+ | `FZF_COLUMNS` | Number of columns fzf takes up excluding padding and margin |
+ | `FZF_TOTAL_COUNT` | Total number of items |
+ | `FZF_MATCH_COUNT` | Number of matched items |
+ | `FZF_SELECT_COUNT` | Number of selected items |
+ | `FZF_QUERY` | Current query string |
+ | `FZF_PROMPT` | Prompt string |
+ | `FZF_ACTION` | The name of the last action performed |
+ - This allows you to write sophisticated transformations like so
+ ```sh
+ # Dynamically resize preview window
+ seq 10000 | fzf --bind 'result:transform:
+ # 1 line for info, another for prompt, and 2 more lines for preview window border
+ lines=$(( FZF_LINES - FZF_MATCH_COUNT - 4 ))
+ if [[ $FZF_MATCH_COUNT -eq 0 ]]; then
+ echo "change-preview-window:hidden"
+ elif [[ $lines -gt 3 ]]; then
+ echo "change-preview-window:$lines"
+ elif [[ $FZF_PREVIEW_LINES -ne 3 ]]; then
+ echo "change-preview-window:3"
+ fi
+ ' --preview 'seq {} 10000' --preview-window up
+ ```
+ - And we're phasing out `{fzf:prompt}` and `{fzf:action}`
- Bug fixes
0.45.0