Commit Graph
100 Commits
Author SHA1 Message Date
Junegunn Choi 31fd207ba2 Add 'r' flag (raw) for unquoted output
By default, placeholder expressions are automatically quoted to ensure
they are safely passed as arguments to external programs.

The r flag ({r}, {r1}, etc.) disables this behavior, outputting the
evaluated value without quotes.

For example,

  echo 'foo   bar' | fzf --preview 'echo {} {r}'

The preview command becomes:

  echo 'foo   bar' foo   bar

Since `{r}` expands to unquoted "foo   bar", 'foo' and 'bar' are passed
as separate arguments.

**Use with caution** Unquoted output can lead to broken commands.

  echo "let's go" | fzf --preview 'echo {r}'

Close #4330
2025-03-30 19:49:05 +09:00
Junegunn Choi ba6d1b8772 Add change-ghost and transform-ghost 2025-03-28 23:35:20 +09:00
Junegunn Choi 0dce561ec9 Fix header window not updated on change-header 2025-03-28 23:23:43 +09:00
Junegunn Choi 664ee1f483 Add change-pointer and transform-pointer
Close #4178
2025-03-28 21:28:25 +09:00
Junegunn Choi dac5b6fde1 Fix info not updated after track-current is disabled due to race condition 2025-03-26 16:00:05 +09:00
Junegunn Choi 998c57442b Fix query precedence in an action chain (#4326)
When 'search' and any action that modifies the query are in an action
chain, anything that comes later takes precedence.
2025-03-26 15:47:43 +09:00
Junegunn Choi 4a0ab6c926 Improve query modification prevention in input-less mode
fzf would restore the original query in input-less mode after executing
a chain of actions.

This commit changes the behavior so that the restoration
happens after each action to allow something like
'show-input+change-query(...)+hide-input'.

Fix #4326
2025-03-26 10:34:52 +09:00
Junegunn Choi f43e82f17f Do not ignore current query when input is hidden
* The initial query given by --query should be respected
* The current query should still be respected after `hide-input`
  (or `toggle-input)

Fix #4327
2025-03-25 21:08:06 +09:00
Junegunn Choi 62238620a5 Fix first entry not clickable when input section is hidden
Fix #4325
2025-03-24 22:08:57 +09:00
Junegunn Choi 200745011a Fix cursor position when prompt is truncated
e.g.
    fzf --preview 'cat {}' --prompt "$(seq 100 | xargs)"
    fzf --preview 'cat {}' --prompt "$(seq 100 | xargs)" --input-border
2025-03-24 17:09:44 +09:00
Junegunn Choi 82fd88339b Fix offset-middle not updating the list 2025-03-23 11:13:21 +09:00
Junegunn Choi 29cf28d845 Suppress 'change' event during bracketed paste mode
Close #4316
2025-03-22 09:17:18 +09:00
Junegunn Choi 7e4dbb5f3b Prevent start:track-current from being disabled
# track-current state can be immediately disabled
  fzf --sync --bind 'start:track-current'
2025-03-20 11:51:20 +09:00
Junegunn Choi 923c3a814d [bash] Fix $FZF_COMPLETION_{DIR,PATH}_OPTS to support non-trivial arguments
This used to fail with 'unknown option: World>'

  export FZF_COMPLETION_PATH_OPTS="--prompt 'Hello World> '"
2025-03-17 18:12:26 +09:00
Junegunn Choi 779e3cc5b5 [vim] Use 24-bit colors on gvim even when &termguicolors is off
Close #2563
2025-03-17 17:46:56 +09:00
Junegunn Choi f92f9f137a Fix wrapping of the list section
# The first line of the second chunk would prematurely wrap
  printf '%0500s\n\n%0500s' 0 0 | fzf --wrap --read0
2025-03-16 01:57:20 +09:00
Junegunn Choi 87f7f436e8 Fix ghost text with inline info
Fix #4312
2025-03-15 18:42:08 +09:00
Junegunn Choi 4298c0b1eb Add --ghost=TEXT to display a ghost text when the input is empty 2025-03-14 16:46:23 +09:00
Junegunn Choi aefb9a5bc4 Nullify unwanted FZF_DEFAULT_* variables in tmux popup
Fix #4298
2025-03-10 18:18:50 +09:00
Junegunn Choi 8868d7cbb8 Add .idea to .gitignore 2025-03-10 18:15:53 +09:00
Junegunn Choi 26bcd0c90d README: Sponsors ❤️ 2025-03-04 18:30:50 +09:00
Junegunn Choi fbece2bb67 Update README 2025-03-04 17:43:02 +09:00
Junegunn Choi 0012183ede 0.60.3 2025-03-03 17:10:49 +09:00
Junegunn Choi 8916cbc6ab [windows] Prevent fzf from consuming user input while paused
This partly fixes #4260.

fzf still can consume the first key stroke.
2025-03-03 14:04:16 +09:00
Junegunn Choi 3ba82b6d87 Make truncateQuery faster
https://github.com/junegunn/fzf/issues/4292#issuecomment-2687051731
2025-02-27 15:49:15 +09:00
Junegunn Choi e771c5d057 Update README 2025-02-27 14:01:13 +09:00
Junegunn Choi 4e5e925e39 Increase the query length limit from 300 to 1000
Close #4292
2025-02-27 11:43:58 +09:00
Junegunn Choi b7248d4115 Remove temp files before 'become' when using --tmux option
Close #4283

But the temp files for the `f` flags in the 'become' template will not
be removed, because we will need them after "becoming" another program.

  e.g. fzf --bind 'enter:become:cat {f}'
2025-02-26 20:47:09 +09:00
Junegunn Choi 639253840f Trim trailing whitespaces after processing ANSI sequences
Close #4282
2025-02-26 16:17:12 +09:00
Junegunn Choi 710ebdf9c1 Make --accept-nth compatible with --select-1
Fix #4287
2025-02-26 00:25:23 +09:00
Junegunn Choi c1accc2e5b Use '/' as path separator on MSYS2
Fix #4281
2025-02-25 10:12:19 +09:00
Junegunn Choi e4489dcbc1 Fix regression: Trim trailing whitespaces when using --with-nth
https://github.com/junegunn/fzf/issues/4272#issuecomment-2677279620
2025-02-24 18:40:13 +09:00
Junegunn Choi c0d407f7ce 0.60.2 2025-02-23 19:52:57 +09:00
Junegunn Choi 461115afde Add support for {n} in --with-nth and --accept-nth templates
Close #4275
2025-02-23 19:47:56 +09:00
Junegunn Choi b89c77ec9a Mention that actions after accept or abort are ignored (#4271) 2025-02-22 22:19:16 +09:00
Junegunn Choi 1ca5f09d7b Explain the difference of template from a single field index expression
Close #4272
2025-02-22 22:14:49 +09:00
Junegunn Choi d79902ae59 Fix 'jump' when pointer is empty
Fix #4270
2025-02-22 19:05:30 +09:00
Junegunn Choi a24d274a3c 0.60.1 2025-02-20 21:42:56 +09:00
Junegunn Choi dac81432d6 [zsh/key-bindings] don't unescape FZF_DEFAULT_OPTS (addendum: #4262) 2025-02-20 20:58:21 +09:00
Junegunn Choi 0ba066123e Fix case where preview window is not scrollable (#4258)
When the last rendered line was wrapped, fzf would incorrectly determine
the scrollability of the window.
2025-02-20 08:22:43 +09:00
Junegunn Choi 81c51c26cc [man] Describe what 'smart-case' mode is
Close #4256
2025-02-20 08:02:04 +09:00
Junegunn Choi 6fa8295ac5 walker: Append path separator to directories
Close #4255
2025-02-18 22:03:59 +09:00
Junegunn Choi f975b40236 Fix {q} in preview window affected by 'search' action 2025-02-18 10:08:47 +09:00
Junegunn Choi 1eafc4e5d9 Ignore NULL byte before CSI 6N response
Close #2455
2025-02-16 21:18:01 +09:00
Junegunn Choi ac32fbb3b2 Avoid printing items in an extremely narrow screen 2025-02-13 22:12:25 +09:00
Junegunn Choi 7d26eca5cc Truncate wrap sign in the list section if necessary 2025-02-13 21:50:53 +09:00
Junegunn Choi 3347d61591 0.60.0 2025-02-13 00:54:21 +09:00
Junegunn Choi 9abf2c8c9c Allow suffix match on --nth with custom --delimiter
When --nth is used with a custom --delimiter, the last delimiter was
included in the search scope, forcing you to write the delimiter in
a suffix-match query. This commit removes the last delimiter from the
search scope.

  # No need to write 'bar,$'
  echo foo,bar,baz | fzf --delimiter , --nth 2 --filter 'bar$'

This can be seen as a breaking change, but I'm gonna say it's a bug fix.

Fix #3983
2025-02-12 20:53:32 +09:00
Junegunn Choi 84e2262ad6 Make --accept-nth and --with-nth support templates 2025-02-12 20:15:04 +09:00
Junegunn Choi 378137d34a Simplify code 2025-02-11 23:43:43 +09:00
Junegunn Choi 66ca16f836 Truncate wrap signs in extremely narrow preview window 2025-02-11 23:41:54 +09:00
Junegunn Choi 19ef8891e3 Print --wrap-sign in preview window
Close #4233
2025-02-11 00:01:50 +09:00
Junegunn Choi a2420026ab Rename actions: exclude and exclude-multi
https://github.com/junegunn/fzf/pull/4231#issuecomment-2646067669
2025-02-09 13:52:20 +09:00
Junegunn Choi 1be1991299 Add exclude-current action
https://github.com/junegunn/fzf/pull/4231#issuecomment-2646063208
2025-02-09 13:37:22 +09:00
Junegunn Choi 67dd7e1923 Add 'exclude' action for excluding current/selected items from the result (#4231)
Close #4185
2025-02-09 13:22:33 +09:00
Junegunn Choi 2b584586ed Add --accept-nth option to transform the output
This option can be used to replace a sed or awk in the post-processing step.

  ps -ef | fzf --multi --header-lines 1 | awk '{print $2}'
  ps -ef | fzf --multi --header-lines 1 --accept-nth 2

This may not be a very "Unix-y" thing to do, so I've always felt that fzf
shouldn't have such an option, but I've finally changed my mind because:

* fzf can be configured with a custom delimiter that is a fixed string
  or a regular expression.
* In such cases, you'd need to repeat the delimiter again in the
  post-processing step.
* Also, tools like awk or sed may interpret a regular expression
  differently, causing mismatches.

You can still use sed, cut, or awk if you prefer.

Close #3987
Close #1323
2025-02-09 11:53:35 +09:00
Junegunn Choi 818d0be436 Fix change-header-label+change-header
Fix #4227
2025-02-07 20:57:09 +09:00
Junegunn Choi fcd2baa945 Fix scrolling performance when --wrap is enabled
Fix #4221
2025-02-06 22:30:39 +09:00
Junegunn Choi 62e0a2824a Fix nth highlighting
Fix #4222
2025-02-06 19:57:39 +09:00
Junegunn Choi bbe1721a18 0.59.0 2025-02-02 23:39:47 +09:00
Junegunn Choi c1470a51b8 Update Dockerfile 2025-02-02 23:10:53 +09:00
Junegunn Choi 6ee31d5dc5 Fix failing test case 2025-02-02 17:46:14 +09:00
Junegunn Choi 65d74387e7 Stop processing more actions after a terminal action (accept, abort, etc.) 2025-02-02 16:28:32 +09:00
Junegunn Choi b7795a3dea Fix RuboCop errors 2025-02-02 02:48:04 +09:00
Junegunn Choi 323f6f6202 Fix mode switching example in CHANGELOG 2025-02-02 02:26:13 +09:00
Junegunn Choi 0c61223884 Fix tcell renderer's pause and resume 2025-02-02 02:23:48 +09:00
Junegunn Choi 32234be7a2 FZF_KEY enhancements
* 'enter' instead of 'ctrl-m'
* 'space' instead of ' '
2025-02-02 02:23:47 +09:00
Junegunn Choi 178b49832e Fix {show,hide,toggle}-input and add test cases 2025-02-01 17:23:22 +09:00
Junegunn Choi 18cbb4a84d Display header lines at the top in 'reverse-list' layout 2025-02-01 17:03:59 +09:00
Junegunn Choi e84afe196a Add {show,hide,toggle}-input and expose $FZF_INPUT_STATE 2025-02-01 17:03:59 +09:00
Junegunn Choi e1e171a3c4 Add toggle-bind 2025-02-01 17:03:59 +09:00
Junegunn Choi d075c00015 Fix --layout reverse-list --no-input 2025-02-01 09:28:02 +09:00
Junegunn Choi 6c0ca4a64a Add --no-input to hide the input section (#4210)
Close #2890
Close #1396
 
You can't type in queries in this mode, and the only way to trigger an
fzf search is to use `search(...)` action.

  # 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}'
2025-01-30 00:50:46 +09:00
Junegunn Choi 7419e0dde1 Update ADVANCED.md 2025-01-29 17:09:22 +09:00
Junegunn Choi eb0257d48f Enhance --min-height option to take number followed by + 2025-01-28 18:34:12 +09:00
Junegunn Choi b83dd6c6b4 Update ADVANCED example using 'search' action 2025-01-28 17:48:46 +09:00
Junegunn Choi 51c207448d Set the default value of --min-height depending on other options 2025-01-27 20:33:47 +09:00
Junegunn Choi a6a558da30 Update junegunn/go-shellwords 2025-01-27 19:21:22 +09:00
Junegunn Choi 2bf5fa27be [completion] Replace 'tr' with built-in string substitution 2025-01-27 19:19:08 +09:00
Junegunn Choi af7940746f Fix test case 2025-01-27 18:12:25 +09:00
Junegunn Choi a2aa1a156c Allow {q} placeholders with range expressions
e.g. {q:1}, {q:2..}
2025-01-27 18:04:57 +09:00
Junegunn Choi 2f8a72a42a More match_count fixes 2025-01-27 15:22:39 +09:00
Junegunn Choi 8179ca5eaa Fix edge cases in --bind where ',' or ':' are chained (#4206) 2025-01-27 09:30:53 +09:00
Junegunn Choi 4b74f882c7 [test] Prefer match_count over item_count
match_count can lag behind item_count and can cause intermittent failures.
2025-01-27 02:08:52 +09:00
Junegunn Choi 7cf45af502 Add --bind example (multi-key binding) 2025-01-27 02:08:39 +09:00
Junegunn Choi 46c21158d8 Update CHANGELOG 2025-01-27 01:52:24 +09:00
Junegunn Choi 80da0776f8 Allow actions to multiple keys and events at once
Close #4206
2025-01-27 01:46:21 +09:00
Junegunn Choi e91f10ab16 Enhance click-header event
* Expose the name of the mouse action as $FZF_KEY
* Trigger click-header on mouse up
* Enhanced clickable header for `kill` completion
2025-01-27 01:10:08 +09:00
Junegunn Choi 2c15cd7923 [completion] Make kill completion header clickable 2025-01-26 16:11:15 +09:00
Junegunn Choi d6584543e9 Make click-header export $FZF_CLICK_HEADER_{NTH,WORD} 2025-01-26 15:37:42 +09:00
Junegunn Choi 7220d8233e Add 'search' and 'transform-search'
Close #4202
2025-01-26 01:50:08 +09:00
Junegunn Choi 0237bf09bf Split integration test file (#4205) 2025-01-25 19:57:40 +09:00
Junegunn Choi 04017c25bb Add 'bell' action to ring the terminal bell 2025-01-25 11:22:32 +09:00
Junegunn Choi 02199cd609 Update CHANGLOG 2025-01-25 10:58:24 +09:00
Junegunn Choi 243a76002c 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
2025-01-24 00:54:53 +09:00
Junegunn Choi c71e4ddee4 Make it possible to change one-time preview window 2025-01-23 18:45:36 +09:00
Junegunn Choi 32eb8c1be9 Fix resizing of a one-time preview window 2025-01-23 18:41:06 +09:00
Junegunn Choi c587017830 Fix header window location and size 2025-01-23 14:45:36 +09:00
Junegunn Choi fb885652cc Fix RuboCop errors 2025-01-23 09:43:12 +09:00
Junegunn Choi afc2f05e5e Fix --info-command when focus event is bound
Fix #4198
2025-01-23 09:31:51 +09:00