From 7220d8233e81291db8bda3d4eb5286ca45f07be0 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 26 Jan 2025 01:50:08 +0900 Subject: Add 'search' and 'transform-search' Close #4202 --- CHANGELOG.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'CHANGELOG.md') diff --git a/CHANGELOG.md b/CHANGELOG.md index a808a5b7..ab795978 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,27 @@ CHANGELOG --bind 'ctrl-r:reload(ps -ef)' --header 'Press CTRL-R to reload' \ --header-lines-border bottom --no-list-border ``` +- 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 + TRANSFORMER=' + words=($FZF_QUERY) + + # If $FZF_QUERY contains multiple words, drop the first word, + # and trigger fzf search with the rest + if [[ ${#words[@]} -gt 1 ]]; then + echo "search:${FZF_QUERY#* }" + + # Otherwise, if the query does not end with a space, + # restart ripgrep and reload the list + elif ! [[ $FZF_QUERY =~ \ $ ]]; then + echo "reload:rg --column --color=always --smart-case \"${words[0]}\"" + fi + ' + fzf --ansi --disabled \ + --with-shell 'bash -c' \ + --bind "start:transform:$TRANSFORMER" \ + --bind "change:transform:$TRANSFORMER" + ``` - Added `bell` action to ring the terminal bell ```sh # Press CTRL-Y to copy the current line to the clipboard and ring the bell -- cgit v1.2.3