mirror of
https://github.com/junegunn/fzf.git
synced 2025-07-26 01:31:59 -07:00
Add 'transform' action to conditionally perform a series of actions
'transform' action runs an external command that prints a series of actions to perform. # Disallow selecting an empty line echo -e "1. Hello\n2. Goodbye\n\n3. Exit" | fzf --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' \ --bind 'enter:transform:[[ -n {} ]] && echo accept || echo "change-header:Invalid selection"' \ --bind 'focus:transform:[[ -n {} ]] && exit; [[ {fzf:action} =~ up$ ]] && echo up || echo down' Close #3368 Close #2980
This commit is contained in:
16
CHANGELOG.md
16
CHANGELOG.md
@@ -3,6 +3,22 @@ CHANGELOG
|
||||
|
||||
0.45.0
|
||||
------
|
||||
- Added `transform` action to conditionally perform a series of actions
|
||||
```sh
|
||||
# Disallow selecting an empty line
|
||||
echo -e "1. Hello\n2. Goodbye\n\n3. Exit" |
|
||||
fzf --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' \
|
||||
--bind 'enter:transform:[[ -n {} ]] && echo accept || echo "change-header:Invalid selection"' \
|
||||
--bind 'focus:transform:[[ -n {} ]] && exit; [[ {fzf:action} =~ up$ ]] && echo up || echo down'
|
||||
```
|
||||
- Added placeholder expressions
|
||||
- `{fzf:action}` - the name of the last action performed
|
||||
- `{fzf:query}` - synonym for `{q}`
|
||||
- Added support for negative height
|
||||
```sh
|
||||
# Terminal height minus 1, so you can still see the command line
|
||||
|
Reference in New Issue
Block a user