Kitty's shell intergration generates a long sequence of key presses in
certain cases. As long as the length of the sequence is finite, fzf can
process it.
Close#2748
So you can "rotate" through the different options with a single binding.
fzf --preview 'cat {}' \
--bind 'ctrl-/:change-preview-window(70%|down,40%,border-horizontal|hidden|)'
Close#2376
The new actions are named with 'change-' prefix to differentiate from
the pre-existing, one-off 'preview(...)' action.
Fix#2360Fix#2505Fix#2666
Related #2435
Related #2376
- Can set up multiple bindings with different change-preview-window actions
- Not possible to "rotate" through the options with a single binding
- Enlarge or shrink not possible
* [tests] Test fzf's placeholders and escaping on practical commands
This tests some reasonable commands in fzf's templates (for commands,
previews, rebinds etc.), how are those commands escaped (backslashes,
double quotes), and documents if the output is executable in cmd.exe.
Both on Unix and Windows.
* [tests] Add testing of placeholder parsing and matching
Adds tests and bit of docs for the curly brackets placeholders in fzf's
template strings. Also tests the "placeholder" regex.
* [tests] Add more test cases of replacing placeholders focused on flags
Replacing placeholders in templates is already tested, this adds tests
that focus more on the parameters of placeholders - e.g. flags, token
ranges.
There is at least one test for each flag, not all combinations are
tested though.
* [refactoring] Split OS-specific function quoteEntry() to corresponding source file
This is minor refactoring, and also the function's test was made
crossplatform.
* [refactoring] Simplify replacePlaceholder function
Should be equivalent to the original, but has simpler structure.
This contains one test case of each tcell.Key* event type that can be
sent to and subsequently processed in fzf's GetChar(). The test cases
describe status quo, and all of them PASS.
Small function util.ToTty() was added. It is similar to util.IsTty(),
but for stdout (hence the To preposition).
Most of the "expected" strings in terminal.go test were changed to
"text/template" values. Quotes in those string were parametrized in
the templates. Two functions handling templates were added
for convenience.
Templates has the advantage of:
- parametrize repetitive strings inside "expected" values
- inner and outer quotes were parametrized in templates
- long and confusing test values are more readable
- templates can be localized for other operating systems
https://github.com/junegunn/fzf/issues/1360#issuecomment-788178140
# Redirect /dev/tty to suppress "Vim: Warning: Input is not from a terminal"
ls | fzf --bind "enter:execute(vim {} < /dev/tty)"
# With this change, we can omit "< /dev/tty" part
ls | fzf --bind "enter:execute(vim {})"