m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 00:03:39 -05:00

Option to prioritize file name matches (#4192)

* 'pathname' is a new tiebreak option for prioritizing matches occurring
  in the file name of the path.

* `--scheme=path` will automatically set `--tiebreak=pathname,length`.

* fzf will automatically choose `path` scheme when the input is a TTY device,
  where fzf would start its built-in walker or run `$FZF_DEFAULT_COMMAND`
  which is usually a command for listing files.

Close #4191
This commit is contained in:
Junegunn Choi
2025-01-24 00:54:53 +09:00
committed by GitHub
parent c71e4ddee4
commit 243a76002c
7 changed files with 127 additions and 28 deletions

View File

@@ -83,6 +83,7 @@ Table of Contents
* [Custom fuzzy completion](#custom-fuzzy-completion)
* [Vim plugin](#vim-plugin)
* [Advanced topics](#advanced-topics)
* [Customizing for different types of input](#customizing-for-different-types-of-input)
* [Performance](#performance)
* [Executing external programs](#executing-external-programs)
* [Turning into a different process](#turning-into-a-different-process)
@@ -718,6 +719,22 @@ See [README-VIM.md](README-VIM.md).
Advanced topics
---------------
### Customizing for different types of input
Since fzf is a general-purpose text filter, its algorithm was designed to
"generally" work well with any kind of input. However, admittedly, there is no
true one-size-fits-all solution, and you may want to tweak the algorithm and
some of the settings depending on the type of the input. To make this process
easier, fzf provides a set of "scheme"s for some common input types.
| Scheme | Description |
| :--- | :--- |
| `--scheme=default` | Generic scheme designed to work well with any kind of input |
| `--scheme=path` | Suitable for file paths |
| `--scheme=history` | Suitable for command history or any input where chronological ordering is important |
(See `fzf --man` for the details)
### Performance
fzf is fast. Performance should not be a problem in most use cases. However,
@@ -727,6 +744,8 @@ you might want to be aware of the options that can affect performance.
makes the initial scanning slower. So it's not recommended that you add it
to your `$FZF_DEFAULT_OPTS`.
- `--nth` makes fzf slower because it has to tokenize each line.
- A plain string `--delimiter` should be preferred over a regular expression
delimiter.
- `--with-nth` makes fzf slower as fzf has to tokenize and reassemble each
line.