-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add 'pathname' tiebreak #4192
Merged
Merged
Add 'pathname' tiebreak #4192
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'pathname' is a tiebreak for prioritizing matches occurring in the tail element of a file path. `--scheme=path` will automatically set `--tiebreak=pathname,length`. Close #4191
10 tasks
b1d0153
to
9773dbd
Compare
And there is no 'reload' action bound to 'start' event.
9773dbd
to
01275d1
Compare
f558cad
to
ea3cf09
Compare
ea3cf09
to
7fe32e3
Compare
junegunn
added a commit
to junegunn/fzf.vim
that referenced
this pull request
Jan 29, 2025
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Feb 6, 2025
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [junegunn/fzf](https://github.com/junegunn/fzf) | minor | `v0.58.0` -> `v0.59.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>junegunn/fzf (junegunn/fzf)</summary> ### [`v0.59.0`](https://github.com/junegunn/fzf/releases/tag/v0.59.0): 0.59.0 [Compare Source](junegunn/fzf@v0.58.0...v0.59.0) *Release highlights: https://junegunn.github.io/fzf/releases/0.59.0/* - Prioritizing file name matches ([#​4192](junegunn/fzf#4192)) - Added a new tiebreak option `pathname` for prioritizing file name matches - `--scheme=path` now sets `--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, - but not when `reload` or `transform` action is bound to `start` event, because in that case, fzf can't be sure of the input type. - Added `--header-lines-border` to display header from `--header-lines` with a separate border ```sh ``` ### Use --header-lines-border to separate two headers ps -ef | fzf --style full --layout reverse --header-lines 1 \ \--bind 'ctrl-r:reload(ps -ef)' --header 'Press CTRL-R to reload' \ \--header-lines-border bottom --no-list-border - `click-header` event now sets `$FZF_CLICK_HEADER_WORD` and `$FZF_CLICK_HEADER_NTH`. You can use them to implement a clickable header for changing the search scope using the new `transform-nth` action. ```sh ### Click on the header line to limit search scope ps -ef | fzf --style full --layout reverse --header-lines 1 \ --header-lines-border bottom --no-list-border \ --color fg:dim,nth:regular \ --bind 'click-header:transform-nth( echo $FZF_CLICK_HEADER_NTH )+transform-prompt( echo "$FZF_CLICK_HEADER_WORD> " )' <!----> - `$FZF_KEY` was updated to expose the type of the click. e.g. `click`, `ctrl-click`, etc. You can use it to implement a more sophisticated behavior. - `kill` completion for bash and zsh were updated to use this feature - Added `--no-input` option to completely disable and hide the input section ```sh ``` ### Click header to trigger search fzf --header '\[src] \[test]' --no-input --layout reverse \ \--header-border bottom --input-border \ \--bind 'click-header:transform-search:echo ${FZF_CLICK_HEADER_WORD:1:-1}' ### Vim-like mode switch fzf --layout reverse-list --no-input \ \--bind 'j:down,k:up,/:show-input+unbind(j,k,/)' \ \--bind 'enter,esc,ctrl-c:transform: if \[\[ $FZF_INPUT_STATE = enabled ]]; then echo "rebind(j,k,/)+hide-input" elif \[\[ $FZF_KEY = enter ]]; then echo accept else echo abort fi ' - You can later show the input section using `show-input` or `toggle-input` action, and hide it again using `hide-input`, or `toggle-input`. - Extended `{q}` placeholder to support ranges. e.g. `{q:1}`, `{q:2..}`, etc. - Added `search(...)` and `transform-search(...)` action to trigger an fzf search with an arbitrary query string. This can be used to extend the search syntax of fzf. In the following example, fzf will use the first word of the query to trigger ripgrep search, and use the rest of the query to perform fzf search within the result. ```sh export TEMP=$(mktemp -u) trap 'rm -f "$TEMP"' EXIT TRANSFORMER=' rg_pat={q:1} # The first word is passed to ripgrep fzf_pat={q:2..} # The rest are passed to fzf if ! [[ -r "$TEMP" ]] || [[ $rg_pat != $(cat "$TEMP") ]]; then echo "$rg_pat" > "$TEMP" printf "reload:sleep 0.1; rg --column --line-number --no-heading --color=always --smart-case %q || true" "$rg_pat" fi echo "+search:$fzf_pat" ' fzf --ansi --disabled \ --with-shell 'bash -c' \ --bind "start,change:transform:$TRANSFORMER" - You can now bind actions to multiple keys and events at once by writing a comma-separated list of keys and events before the colon ```sh ``` ### Load 'ps -ef' output on start and reload it on CTRL-R fzf --bind 'start,ctrl-r:reload:ps -ef' - `--min-height` option now takes a number followed by `+`, which tells fzf to show at least that many items in the list section. The default value is now changed to `10+`. ```sh ### You will only see the input section which takes 3 lines fzf --style=full --height 1% --min-height 3 ### You will see 3 items in the list section fzf --style full --height 1% --min-height 3+ <!----> - Shell integration scripts were updated to use `--min-height 20+` by default - `--header-lines` will be displayed at the top in `reverse-list` layout - Added `bell` action to ring the terminal bell ```sh ``` ### Press CTRL-Y to copy the current line to the clipboard and ring the bell fzf --bind 'ctrl-y:execute-silent(echo -n {} | pbcopy)+bell' - Added `toggle-bind` action - Bug fixes and improvements - Fixed fish script to support fish 3.1.2 or later (@​bitraid) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNjEuNiIsInVwZGF0ZWRJblZlciI6IjM5LjE2MS42IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Aura7988
pushed a commit
to Aura7988/fzf.vim
that referenced
this pull request
Feb 8, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
'pathname' is a tiebreak for prioritizing matches occurring in the tail element of a file path.
--scheme=path
will automatically set--tiebreak=pathname,length
.Close #4191
Examples
$ fzf -fs | head -10 src/LICENSE src/ansi.go src/core.go src/item.go src/tmux.go src/cache.go src/proxy.go src/merger.go src/reader.go src/result.go
$ fzf -fs --scheme=path | head -10 src/server.go src/util/slab.go .github/workflows/sponsors.yml src/LICENSE src/ansi.go src/core.go src/item.go src/tmux.go src/cache.go src/proxy.go