From 243a76002c93b474cf8401b37670a43803a0a2d2 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Fri, 24 Jan 2025 00:54:53 +0900 Subject: 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 --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 4d235998..5164c4b1 100644 --- a/README.md +++ b/README.md @@ -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. -- cgit v1.2.3