Add 'search' and 'transform-search'
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Close #4202
authored by Junegunn Choi · committed by Junegunn Choi · parent 0237bf0 · Browse files · 7 files·+173 added−54 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
7 files+173 added−54 removed
- tests:+18 added−0 removed
- other:+155 added−54 removed
Provenance
- Commit
7220d82- Tree
0bbb9c4- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
0237bf0
7 files changed+173 added−54 removed
modified:man/man1/fzf.1+4 added-2 removed
92 unmodified lines93 94 .RS95 fzf chooses \fBpath\fR scheme when the input is a TTY device, where fzf would96 start its built-in walker or run \fB$FZF_DEFAULT_COMMAND\fR, and there is no97-\fBreload\fR action bound to \fBstart\fR event. Otherwise, it chooses98-\fBdefault\fR scheme.97+\fBreload\fR or \fBtransform\fR action bound to \fBstart\fR event. Otherwise,98+it chooses \fBdefault\fR scheme.99 .RE100 101 .TP102 .BI "\-\-algo=" TYPE1505 unmodified lines1608 \fBrebind(...)\fR (rebind bindings after \fBunbind\fR)1609 \fBreload(...)\fR (see below for the details)1610 \fBreload\-sync(...)\fR (see below for the details)1611 \fBreplace\-query\fR (replace query string with the current selection)1612+ \fBsearch(...)\fR (trigger fzf search with the given string)1613 \fBselect\fR1614 \fBselect\-all\fR (select all matches)1615 \fBshow\-header\fR1616 \fBshow\-preview\fR22 unmodified lines1639 \fBtransform\-list\-label(...)\fR (transform list label using an external command)1640 \fBtransform\-preview\-label(...)\fR (transform preview label using an external command)1641 \fBtransform\-prompt(...)\fR (transform prompt string using an external command)1642 \fBtransform\-query(...)\fR (transform query string using an external command)1643+ \fBtransform\-search(...)\fR (trigger fzf search with the output of an external command)1644 \fBunbind(...)\fR (unbind bindings)1645 \fBunix\-line\-discard\fR \fIctrl\-u\fR1646 \fBunix\-word\-rubout\fR \fIctrl\-w\fR1647 \fBuntrack\-current\fR (stop tracking the current item; no-op if global tracking is enabled)175 unmodified linesmodified:src/actiontype_string.go+39 added-36 removed
94 unmodified lines95 _ = x[actTransformHeaderLabel-84]96 _ = x[actTransformPreviewLabel-85]97 _ = x[actTransformPrompt-86]98 _ = x[actTransformQuery-87]99- _ = x[actPreview-88]100- _ = x[actChangePreview-89]101- _ = x[actChangePreviewWindow-90]102- _ = x[actPreviewTop-91]103- _ = x[actPreviewBottom-92]104- _ = x[actPreviewUp-93]105- _ = x[actPreviewDown-94]106- _ = x[actPreviewPageUp-95]107- _ = x[actPreviewPageDown-96]108- _ = x[actPreviewHalfPageUp-97]109- _ = x[actPreviewHalfPageDown-98]110- _ = x[actPrevHistory-99]111- _ = x[actPrevSelected-100]112- _ = x[actPrint-101]113- _ = x[actPut-102]114- _ = x[actNextHistory-103]115- _ = x[actNextSelected-104]116- _ = x[actExecute-105]117- _ = x[actExecuteSilent-106]118- _ = x[actExecuteMulti-107]119- _ = x[actSigStop-108]120- _ = x[actFirst-109]121- _ = x[actLast-110]122- _ = x[actReload-111]123- _ = x[actReloadSync-112]124- _ = x[actDisableSearch-113]125- _ = x[actEnableSearch-114]126- _ = x[actSelect-115]127- _ = x[actDeselect-116]128- _ = x[actUnbind-117]129- _ = x[actRebind-118]130- _ = x[actBecome-119]131- _ = x[actShowHeader-120]132- _ = x[actHideHeader-121]99+ _ = x[actTransformSearch-88]100+ _ = x[actSearch-89]101+ _ = x[actPreview-90]102+ _ = x[actChangePreview-91]103+ _ = x[actChangePreviewWindow-92]104+ _ = x[actPreviewTop-93]105+ _ = x[actPreviewBottom-94]106+ _ = x[actPreviewUp-95]107+ _ = x[actPreviewDown-96]108+ _ = x[actPreviewPageUp-97]109+ _ = x[actPreviewPageDown-98]110+ _ = x[actPreviewHalfPageUp-99]111+ _ = x[actPreviewHalfPageDown-100]112+ _ = x[actPrevHistory-101]113+ _ = x[actPrevSelected-102]114+ _ = x[actPrint-103]115+ _ = x[actPut-104]116+ _ = x[actNextHistory-105]117+ _ = x[actNextSelected-106]118+ _ = x[actExecute-107]119+ _ = x[actExecuteSilent-108]120+ _ = x[actExecuteMulti-109]121+ _ = x[actSigStop-110]122+ _ = x[actFirst-111]123+ _ = x[actLast-112]124+ _ = x[actReload-113]125+ _ = x[actReloadSync-114]126+ _ = x[actDisableSearch-115]127+ _ = x[actEnableSearch-116]128+ _ = x[actSelect-117]129+ _ = x[actDeselect-118]130+ _ = x[actUnbind-119]131+ _ = x[actRebind-120]132+ _ = x[actBecome-121]133+ _ = x[actShowHeader-122]134+ _ = x[actHideHeader-123]135+ _ = x[actBell-124]136 }137 135-const _actionType_name = "actIgnoreactStartactClickactInvalidactCharactMouseactBeginningOfLineactAbortactAcceptactAcceptNonEmptyactAcceptOrPrintQueryactBackwardCharactBackwardDeleteCharactBackwardDeleteCharEofactBackwardWordactCancelactChangeBorderLabelactChangeListLabelactChangeInputLabelactChangeHeaderactChangeHeaderLabelactChangeMultiactChangePreviewLabelactChangePromptactChangeQueryactChangeNthactClearScreenactClearQueryactClearSelectionactCloseactDeleteCharactDeleteCharEofactEndOfLineactFatalactForwardCharactForwardWordactKillLineactKillWordactUnixLineDiscardactUnixWordRuboutactYankactBackwardKillWordactSelectAllactDeselectAllactToggleactToggleSearchactToggleAllactToggleDownactToggleUpactToggleInactToggleOutactToggleTrackactToggleTrackCurrentactToggleHeaderactToggleWrapactToggleMultiLineactToggleHscrollactTrackCurrentactUntrackCurrentactDownactUpactPageUpactPageDownactPositionactHalfPageUpactHalfPageDownactOffsetUpactOffsetDownactOffsetMiddleactJumpactJumpAcceptactPrintQueryactRefreshPreviewactReplaceQueryactToggleSortactShowPreviewactHidePreviewactTogglePreviewactTogglePreviewWrapactTransformactTransformBorderLabelactTransformListLabelactTransformInputLabelactTransformHeaderactTransformHeaderLabelactTransformPreviewLabelactTransformPromptactTransformQueryactPreviewactChangePreviewactChangePreviewWindowactPreviewTopactPreviewBottomactPreviewUpactPreviewDownactPreviewPageUpactPreviewPageDownactPreviewHalfPageUpactPreviewHalfPageDownactPrevHistoryactPrevSelectedactPrintactPutactNextHistoryactNextSelectedactExecuteactExecuteSilentactExecuteMultiactSigStopactFirstactLastactReloadactReloadSyncactDisableSearchactEnableSearchactSelectactDeselectactUnbindactRebindactBecomeactShowHeaderactHideHeader"138+const _actionType_name = "actIgnoreactStartactClickactInvalidactCharactMouseactBeginningOfLineactAbortactAcceptactAcceptNonEmptyactAcceptOrPrintQueryactBackwardCharactBackwardDeleteCharactBackwardDeleteCharEofactBackwardWordactCancelactChangeBorderLabelactChangeListLabelactChangeInputLabelactChangeHeaderactChangeHeaderLabelactChangeMultiactChangePreviewLabelactChangePromptactChangeQueryactChangeNthactClearScreenactClearQueryactClearSelectionactCloseactDeleteCharactDeleteCharEofactEndOfLineactFatalactForwardCharactForwardWordactKillLineactKillWordactUnixLineDiscardactUnixWordRuboutactYankactBackwardKillWordactSelectAllactDeselectAllactToggleactToggleSearchactToggleAllactToggleDownactToggleUpactToggleInactToggleOutactToggleTrackactToggleTrackCurrentactToggleHeaderactToggleWrapactToggleMultiLineactToggleHscrollactTrackCurrentactUntrackCurrentactDownactUpactPageUpactPageDownactPositionactHalfPageUpactHalfPageDownactOffsetUpactOffsetDownactOffsetMiddleactJumpactJumpAcceptactPrintQueryactRefreshPreviewactReplaceQueryactToggleSortactShowPreviewactHidePreviewactTogglePreviewactTogglePreviewWrapactTransformactTransformBorderLabelactTransformListLabelactTransformInputLabelactTransformHeaderactTransformHeaderLabelactTransformPreviewLabelactTransformPromptactTransformQueryactTransformSearchactSearchactPreviewactChangePreviewactChangePreviewWindowactPreviewTopactPreviewBottomactPreviewUpactPreviewDownactPreviewPageUpactPreviewPageDownactPreviewHalfPageUpactPreviewHalfPageDownactPrevHistoryactPrevSelectedactPrintactPutactNextHistoryactNextSelectedactExecuteactExecuteSilentactExecuteMultiactSigStopactFirstactLastactReloadactReloadSyncactDisableSearchactEnableSearchactSelectactDeselectactUnbindactRebindactBecomeactShowHeaderactHideHeaderactBell"139 137-var _actionType_index = [...]uint16{0, 9, 17, 25, 35, 42, 50, 68, 76, 85, 102, 123, 138, 159, 183, 198, 207, 227, 245, 264, 279, 299, 313, 334, 349, 363, 375, 389, 402, 419, 427, 440, 456, 468, 476, 490, 504, 515, 526, 544, 561, 568, 587, 599, 613, 622, 637, 649, 662, 673, 684, 696, 710, 731, 746, 759, 777, 793, 808, 825, 832, 837, 846, 857, 868, 881, 896, 907, 920, 935, 942, 955, 968, 985, 1000, 1013, 1027, 1041, 1057, 1077, 1089, 1112, 1133, 1155, 1173, 1196, 1220, 1238, 1255, 1265, 1281, 1303, 1316, 1332, 1344, 1358, 1374, 1392, 1412, 1434, 1448, 1463, 1471, 1477, 1491, 1506, 1516, 1532, 1547, 1557, 1565, 1572, 1581, 1594, 1610, 1625, 1634, 1645, 1654, 1663, 1672, 1685, 1698}140+var _actionType_index = [...]uint16{0, 9, 17, 25, 35, 42, 50, 68, 76, 85, 102, 123, 138, 159, 183, 198, 207, 227, 245, 264, 279, 299, 313, 334, 349, 363, 375, 389, 402, 419, 427, 440, 456, 468, 476, 490, 504, 515, 526, 544, 561, 568, 587, 599, 613, 622, 637, 649, 662, 673, 684, 696, 710, 731, 746, 759, 777, 793, 808, 825, 832, 837, 846, 857, 868, 881, 896, 907, 920, 935, 942, 955, 968, 985, 1000, 1013, 1027, 1041, 1057, 1077, 1089, 1112, 1133, 1155, 1173, 1196, 1220, 1238, 1255, 1273, 1282, 1292, 1308, 1330, 1343, 1359, 1371, 1385, 1401, 1419, 1439, 1461, 1475, 1490, 1498, 1504, 1518, 1533, 1543, 1559, 1574, 1584, 1592, 1599, 1608, 1621, 1637, 1652, 1661, 1672, 1681, 1690, 1699, 1712, 1725, 1732}141 142 func (i actionType) String() string {143 if i < 0 || i >= actionType(len(_actionType_index)-1) {144 return "actionType(" + strconv.FormatInt(int64(i), 10) + ")"3 unmodified linesmodified:src/options.go+8 added-4 removed
1330 unmodified lines1331 )1332 1333 func init() {1334 executeRegexp = regexp.MustCompile(1335- `(?si)[:+](become|execute(?:-multi|-silent)?|reload(?:-sync)?|preview|(?:change|transform)-(?:query|prompt|(?:border|list|preview|input|header)-label|header)|transform|change-(?:preview-window|preview|multi|nth)|(?:re|un)bind|pos|put|print)`)1335+ `(?si)[:+](become|execute(?:-multi|-silent)?|reload(?:-sync)?|preview|(?:change|transform)-(?:query|prompt|(?:border|list|preview|input|header)-label|header|search)|transform|change-(?:preview-window|preview|multi|nth)|(?:re|un)bind|pos|put|print|search)`)1336 splitRegexp = regexp.MustCompile("[,:]+")1337 actionNameRegexp = regexp.MustCompile("(?i)^[a-z-]+")1338 }1339 403 unmodified lines1743 case "transform-prompt":1744 return actTransformPrompt1745 case "transform-query":1746 return actTransformQuery1747+ case "transform-search":1748+ return actTransformSearch1749+ case "search":1750+ return actSearch1751 }1752 return actIgnore1753 }1754 1500 unmodified lines3255 // In that case, you can either3256 // 1. explicitly set --scheme=default,3257 // 2. or replace $FZF_DEFAULT_COMMAND with an equivalent 'start:reload'3258 // binding, which is the new preferred way.3255- if !opts.hasReloadOnStart() && util.IsTty(os.Stdin) {3259+ if !opts.hasReloadOrTransformOnStart() && util.IsTty(os.Stdin) {3260 opts.Scheme = "path"3261 }3262 _, opts.Criteria, _ = parseScheme(opts.Scheme)3263 }6 unmodified lines3270 3271 return opts, nil3272 }3273 3270-func (opts *Options) hasReloadOnStart() bool {3274+func (opts *Options) hasReloadOrTransformOnStart() bool {3275 if actions, prs := opts.Keymap[tui.Start.AsEvent()]; prs {3276 for _, action := range actions {3273- if action.t == actReload || action.t == actReloadSync {3277+ if action.t == actReload || action.t == actReloadSync || action.t == actTransform {3278 return true3279 }3280 }3281 }18 unmodified linesmodified:src/terminal.go+38 added-10 removed
275 unmodified lines276 offset int277 xoffset int278 yanked []rune279 input []rune280+ inputOverride *[]rune281 multi int282 multiLine bool283 sort bool284 toggleSort bool248 unmodified lines533 actTransformHeaderLabel534 actTransformPreviewLabel535 actTransformPrompt536 actTransformQuery537+ actTransformSearch538+ actSearch539 actPreview540 actChangePreview541 actChangePreviewWindow542 actPreviewTop813 unmodified lines1356 // Input returns current query string1357 func (t *Terminal) Input() (bool, []rune) {1358 t.mutex.Lock()1359 defer t.mutex.Unlock()1357- return t.paused, copySlice(t.input)1360+ paused := t.paused1361+ src := t.input1362+ if t.inputOverride != nil {1363+ paused = false1364+ src = *t.inputOverride1365+ }1366+ return paused, copySlice(src)1367 }1368 1369 // UpdateCount updates the count information1370 func (t *Terminal) UpdateCount(cnt int, final bool, failedCommand *string) {2474 unmodified lines3845 t.tui.Refresh()3846 t.printAll()3847 }3848 3849+func (t *Terminal) captureLine(template string) string {3850+ return t.executeCommand(template, false, true, true, true, "")3851+}3852+3853+func (t *Terminal) captureLines(template string) string {3854+ return t.executeCommand(template, false, true, true, false, "")3855+}3856+3857 func (t *Terminal) executeCommand(template string, forcePlus bool, background bool, capture bool, firstLineOnly bool, info string) string {3858 line := ""3859 valid, list := t.buildPlusList(template, forcePlus)3860 // 'capture' is used for transform-* and we don't want to906 unmodified lines4767 t.previewed.version = 04768 req(reqPreviewRefresh)4769 }4770 case actTransformPrompt:4754- prompt := t.executeCommand(a.a, false, true, true, true, "")4771+ prompt := t.captureLine(a.a)4772 t.promptString = prompt4773 t.prompt, t.promptLen = t.parsePrompt(prompt)4774 req(reqPrompt)4775 case actTransformQuery:4759- query := t.executeCommand(a.a, false, true, true, true, "")4776+ query := t.captureLine(a.a)4777 t.input = []rune(query)4778 t.cx = len(t.input)4779 case actToggleSort:4780 t.sort = !t.sort75 unmodified lines4856 t.cx = len(t.input)4857 case actChangeHeader, actTransformHeader:4858 header := a.a4859 if a.t == actTransformHeader {4843- header = t.executeCommand(a.a, false, true, true, false, "")4860+ header = t.captureLines(a.a)4861 }4862 if t.changeHeader(header) {4863 req(reqHeader, reqList, reqPrompt, reqInfo)4864 } else {29 unmodified lines4894 t.previewLabel, t.previewLabelLen = t.ansiLabelPrinter(a.a, &tui.ColPreviewLabel, false)4895 req(reqRedrawPreviewLabel)4896 }4897 case actTransform:4881- body := t.executeCommand(a.a, false, true, true, false, "")4898+ body := t.captureLines(a.a)4899 if actions, err := parseSingleActionList(strings.Trim(body, "\r\n")); err == nil {4900 return doActions(actions)4901 }4902 case actTransformHeaderLabel:4886- label := t.executeCommand(a.a, false, true, true, true, "")4903+ label := t.captureLine(a.a)4904 t.headerLabelOpts.label = label4905 if t.headerBorder != nil {4906 t.headerLabel, t.headerLabelLen = t.ansiLabelPrinter(label, &tui.ColHeaderLabel, false)4907 req(reqRedrawHeaderLabel)4908 }4909 case actTransformInputLabel:4893- label := t.executeCommand(a.a, false, true, true, true, "")4910+ label := t.captureLine(a.a)4911 t.inputLabelOpts.label = label4912 if t.inputBorder != nil {4913 t.inputLabel, t.inputLabelLen = t.ansiLabelPrinter(label, &tui.ColInputLabel, false)4914 req(reqRedrawInputLabel)4915 }4916 case actTransformListLabel:4900- label := t.executeCommand(a.a, false, true, true, true, "")4917+ label := t.captureLine(a.a)4918 t.listLabelOpts.label = label4919 if t.wborder != nil {4920 t.listLabel, t.listLabelLen = t.ansiLabelPrinter(label, &tui.ColListLabel, false)4921 req(reqRedrawListLabel)4922 }4923 case actTransformBorderLabel:4907- label := t.executeCommand(a.a, false, true, true, true, "")4924+ label := t.captureLine(a.a)4925 t.borderLabelOpts.label = label4926 if t.border != nil {4927 t.borderLabel, t.borderLabelLen = t.ansiLabelPrinter(label, &tui.ColBorderLabel, false)4928 req(reqRedrawBorderLabel)4929 }4930 case actTransformPreviewLabel:4914- label := t.executeCommand(a.a, false, true, true, true, "")4931+ label := t.captureLine(a.a)4932 t.previewLabelOpts.label = label4933 if t.pborder != nil {4934 t.previewLabel, t.previewLabelLen = t.ansiLabelPrinter(label, &tui.ColPreviewLabel, false)4935 req(reqRedrawPreviewLabel)389 unmodified lines5325 if t.track == trackCurrent {5326 t.track = trackDisabled5327 }5328 req(reqInfo)5329+ case actSearch:5330+ override := []rune(a.a)5331+ t.inputOverride = &override5332+ changed = true5333+ case actTransformSearch:5334+ override := []rune(t.captureLine(a.a))5335+ t.inputOverride = &override5336+ changed = true5337 case actEnableSearch:5338 t.paused = false5339 changed = true5340 req(reqPrompt)417 unmodified lines5758 continue5759 }5760 t.truncateQuery()5761 queryChanged = string(previousInput) != string(t.input)5762+ if queryChanged {5763+ t.inputOverride = nil5764+ }5765 changed = changed || queryChanged5766 if onChanges, prs := t.keymap[tui.Change.AsEvent()]; queryChanged && prs && !doActions(onChanges) {5767 continue5768 }259 unmodified linesmodified:test/test_core.rb+18 added
1067 unmodified lines1068 tmux.send_keys :Up1069 tmux.until { |lines| assert_equal 'up', lines[-1] }1070 end1071 1072+ def test_search1073+ tmux.send_keys %(seq 100 | #{FZF} --query 0 --bind space:search:1), :Enter1074+ tmux.until { |lines| assert_equal 10, lines.match_count }1075+ tmux.send_keys :Space1076+ tmux.until { |lines| assert_equal 20, lines.match_count }1077+ tmux.send_keys '0'1078+ tmux.until { |lines| assert_equal 1, lines.match_count }1079+ end1080+1081+ def test_transform_search1082+ tmux.send_keys %(seq 1000 | #{FZF} --bind 'change:transform-search:echo {q}{q}'), :Enter1083+ tmux.until { |lines| assert_equal 1000, lines.match_count }1084+ tmux.send_keys '1'1085+ tmux.until { |lines| assert_equal 28, lines.match_count }1086+ tmux.send_keys :BSpace, '0'1087+ tmux.until { |lines| assert_equal 10, lines.match_count }1088+ end1089+1090 def test_clear_selection1091 tmux.send_keys %(seq 100 | #{FZF} --multi --bind space:clear-selection), :Enter1092 tmux.until { |lines| assert_equal 100, lines.match_count }1093 tmux.send_keys :Tab513 unmodified linesmodified:ADVANCED.md+45 added-2 removed
1 Advanced fzf examples2 ======================3 4-* *Last update: 2024/06/24*5-* *Requires fzf 0.54.0 or later*4+* *Last update: 2025/01/26*5+* *Requires fzf 0.59.0 or later*6 7 ---8 9 <!-- vim-markdown-toc GFM -->11 unmodified lines21 * [Using fzf as interactive Ripgrep launcher](#using-fzf-as-interactive-ripgrep-launcher)22 * [Switching to fzf-only search mode](#switching-to-fzf-only-search-mode)23 * [Switching between Ripgrep mode and fzf mode](#switching-between-ripgrep-mode-and-fzf-mode)24 * [Switching between Ripgrep mode and fzf mode using a single key binding](#switching-between-ripgrep-mode-and-fzf-mode-using-a-single-key-binding)25+ * [Controlling Ripgrap search and fzf search simultaneously](#controlling-ripgrap-search-and-fzf-search-simultaneously)26 * [Log tailing](#log-tailing)27 * [Key bindings for git objects](#key-bindings-for-git-objects)28 * [Files listed in `git status`](#files-listed-in-git-status)29 * [Branches](#branches)470 unmodified lines500 --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' \501 --bind 'enter:become(vim {1} +{2})'502 ```503 504+### Controlling Ripgrap search and fzf search simultaneously505+506+fzf 0.59.0 added `search` action that allows you to trigger an fzf search507+with an arbitrary query string. This means fzf is no longer restricted to the508+exact query entered in the prompt.509+510+In the example below, `transform` action is used to conditionally trigger511+either `reload` for ripgrep or `search` for fzf. The first word of the query512+initiates the Ripgrep process to generate the initial results, while the513+remainder of the query is passed to fzf for secondary filtering.514+515+```sh516+#!/usr/bin/env bash517+518+# Switch between Ripgrep mode and fzf filtering mode (CTRL-T)519+RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case "520+INITIAL_QUERY="${*:-}"521+TRANSFORMER='522+ words=($FZF_QUERY)523+524+ # If $FZF_QUERY contains multiple words, drop the first word,525+ # and trigger fzf search with the rest526+ if [[ ${#words[@]} -gt 1 ]]; then527+ echo "search:${FZF_QUERY#* }"528+529+ # Otherwise, if the query does not end with a space,530+ # restart ripgrep and reload the list531+ elif ! [[ $FZF_QUERY =~ \ $ ]]; then532+ echo "reload:sleep 0.1; $RG_PREFIX \"${words[0]}\" || true"533+ fi534+'535+fzf --ansi --disabled --query "$INITIAL_QUERY" \536+ --with-shell 'bash -c' \537+ --bind "start:transform:$TRANSFORMER" \538+ --bind "change:transform:$TRANSFORMER" \539+ --color "hl:-1:underline,hl+:-1:underline:reverse" \540+ --delimiter : \541+ --preview 'bat --color=always {1} --highlight-line {2}' \542+ --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' \543+ --bind 'enter:become(vim {1} +{2})'544+```545+546 Log tailing547 -----------548 549 fzf can run long-running preview commands and render partial results before170 unmodified linesmodified:CHANGELOG.md+21 added
12 unmodified lines13 ps -ef | fzf --style full --layout reverse --header-lines 1 \14 --bind 'ctrl-r:reload(ps -ef)' --header 'Press CTRL-R to reload' \15 --header-lines-border bottom --no-list-border16 ```17+- 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.18+ ```sh19+ TRANSFORMER='20+ words=($FZF_QUERY)21+22+ # If $FZF_QUERY contains multiple words, drop the first word,23+ # and trigger fzf search with the rest24+ if [[ ${#words[@]} -gt 1 ]]; then25+ echo "search:${FZF_QUERY#* }"26+27+ # Otherwise, if the query does not end with a space,28+ # restart ripgrep and reload the list29+ elif ! [[ $FZF_QUERY =~ \ $ ]]; then30+ echo "reload:rg --column --color=always --smart-case \"${words[0]}\""31+ fi32+ '33+ fzf --ansi --disabled \34+ --with-shell 'bash -c' \35+ --bind "start:transform:$TRANSFORMER" \36+ --bind "change:transform:$TRANSFORMER"37+ ```38 - Added `bell` action to ring the terminal bell39 ```sh40 # Press CTRL-Y to copy the current line to the clipboard and ring the bell41 fzf --bind 'ctrl-y:execute-silent(echo -n {} | pbcopy)+bell'2435 unmodified lines