Commit Graph

370 Commits (master)

Author SHA1 Message Date
Junegunn Choi cfc0747d5d
Follow Rubocop suggestion 1 year ago
Junegunn Choi fcd7e8768d
Omit port number in `--listen` for automatic port assignment
Close #3200
1 year ago
Junegunn Choi 3c34dd8275
Fix extra new line in the preview window
When a colored text ends at the right end of the window

Fix #3209
1 year ago
Junegunn Choi 96c3de12eb
Run 'become' only when the command template is properly evaluated 1 year ago
Junegunn Choi 6ea38b4438
Add become(...) action that replaces current fzf process
Close #3159
1 year ago
Junegunn Choi aa2b9ec476
Add 'show-preview' and 'hide-preview'
For cases where 'toggle-preview' is not enough
1 year ago
Junegunn Choi 3ee00f8bc2
toggle-preview should not show empty preview window 1 year ago
Junegunn Choi fccab60a5c
`--preview-window 0,hidden` should not execute the preview command
Until `toggle-preview` action is triggered

Fix #3149
1 year ago
Junegunn Choi 618d317803
Support custom separator of inline info
Close #2030
Close #3084
1 year ago
Junegunn Choi 284d77fe2e
Add 'focus' event
Can we find a better name? I have considered the followings.

* 'point', because "the pointer" points to the current item.
* 'shift', 'switch', 'move', etc. These are not technically correct
  because the current item can change without cursor movement (--tac,
  reload, search update)
* 'change' is already taken. 'change-current' feels a bit wordy and
  sounds wrong, 'current-changed' is wordy and doesn't go well with the
  other event names
* 'target', not straightforward

Close #3053
1 year ago
Junegunn Choi d51980a3f5 Add 'transform-border-label' and 'transform-preview-label' 1 year ago
Junegunn Choi 77874b473c
Update Rubocop dependencies 1 year ago
Junegunn Choi b7cce7be15
Remove unused block argument 1 year ago
Junegunn Choi 3cd3362417
Fix test failure 1 year ago
Junegunn Choi e97e925efb
Resume preview following if the user scrolls the window to the bottom 1 year ago
Junegunn Choi 23d8b78ce1
Allow toggling of alternative preview window layout that is hidden
Fix #3113
1 year ago
Junegunn Choi 3b2244077d
Add scrollbar to the preview window 1 year ago
Junegunn Choi 5cd6f1d064
Add scrollbar
Close #3096
1 year ago
Junegunn Choi 62c7f59b94
Add transform-prompt(...) action 1 year ago
Junegunn Choi d649f5d826
Always execute preview command if {q} is in the template
Even when {q} is empty. Because, why not?

While this can be seen as a breaking change, there is an easy workaround
to keep the old behavior.

    # This will show // even when the query is empty
    : | fzf --preview 'echo /{q}/'

    # But if you don't want it,
    : | fzf --preview '[ -n {q} ] || exit; echo /{q}/'

Close #2759
1 year ago
Junegunn Choi 6c37177cf5
Add reload-sync action
Close #2816
1 year ago
Junegunn Choi 36d2bb332b
Add transform-query(...) action
Test case authored by @SpicyLemon

Close #1930
Close #2465
Close #2559
Close #2509 (e.g. fzf --bind 'space:transform-query:printf %s%s {q} {}')
1 year ago
Junegunn Choi 4b3f0b9f08
Allow put action with an argument i.e. put(...) 1 year ago
Junegunn Choi 12af069dca
Add pos(...) action to move the cursor to the numeric position
# Put the cursor on the 10th item
  seq 100 | fzf --sync --bind 'start:pos(10)'

  # Put the cursor on the 10th to last item
  seq 100 | fzf --sync --bind 'start:pos(-10)'

Close #3069
Close #395
1 year ago
Junegunn Choi b7bb973118
Revert "Add GET endpoints for getting the state of the finder"
This reverts commit 750b2a6313.

This can cause a deadlock if the endpoints are accessed in the core event
loop via execute action.

  fzf --listen 6266 --bind 'space:execute:curl localhost:6266'

Technically, there's no reason to use the API because the information is
already available via `{}` and `{q}`, but I'd like to completely remove
the risk of misuse.
1 year ago
Junegunn Choi 750b2a6313
Add GET endpoints for getting the state of the finder
* GET / (or GET /current)
* GET /query
1 year ago
Junegunn Choi 6d14573fd0 Add test case for --listen 1 year ago
Junegunn Choi 51c518da1e
Add change-query(...) action 1 year ago
Junegunn Choi 18e3b38c69
Add 'next-selected' and 'prev-selected' actions
Close #2749
1 year ago
Junegunn Choi 1bebd6f4f5
Fix panic on inverse match query with `--tiebreak=chunk`
Fix #3055
2 years ago
Junegunn Choi 8868d7d188
Add --separator to customize the info separator 2 years ago
Junegunn Choi f6ce624c6f
Add tests for --border-label and --preview-label
Also fix failing tests due to info separator

Related #3022 #3029
2 years ago
Junegunn Choi 168829b555
Add 'start' event that is triggered once when fzf finder starts
Close #1622
2 years ago
John Fred Fadrigalan 4603d540c3
[shell] Make bash/zsh completion and bindings work with 'set -u' (#2999)
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
2 years ago
Junegunn Choi 22cbd9fa58
Implement height range (--height ~[VALUE][%])
Close #2953
2 years ago
Junegunn Choi 38259d0382
Fix incorrect ordering of `--tiebreak=chunk` 2 years ago
Junegunn Choi f0bfeba733
Add new tiebreak: 'chunk'
Favors the line with shorter matched chunk. A chunk is a set of
consecutive non-whitespace characters.

Unlike the default `length`, this new scheme works well with tabular input.

  # length prefers item #1, because the whole line is shorter,
  # chunk prefers item #2, because the matched chunk ("foo") is shorter
  fzf --height=6 --header-lines=2 --tiebreak=chunk --reverse --query=fo << "EOF"
  N | Field1 | Field2 | Field3
  - | ------ | ------ | ------
  1 | hello  | foobar | baz
  2 | world  | foo    | bazbaz
  EOF

If the input does not contain any spaces, `chunk` is equivalent to
`length`. But we're not going to set it as the default because it is
computationally more expensive.

Close #2285
Close #2537
- Not the exact solution to --tiebreak=length not taking --nth into account,
  but this should work. And the added benefit is that it works well even
  when --nth is not provided.
- Adding a bonus point to the last character of a word didn't turn out great.
  The order of the result suddenly changes when you type in the last
  character in the word producing a jarring effect.
2 years ago
Junegunn Choi 52594355bf
[shell] 'kill' completion will now require trigger sequence (**)
'kill **<tab>' instead of 'kill <tab>' just like any other completions.

Close #2716
Close #385
2 years ago
Junegunn Choi d56f605b63
Add `rebind` action for restoring bindings after `unbind`
Fix #2752
Close #2564
2 years ago
Junegunn Choi 5209e95bc7
Make preview updated when reload and change-query are combined
Fix #2744
2 years ago
Junegunn Choi ef67a45702
Add --ellipsis=.. option
Close #2432

Also see
- #1769
- https://github.com/junegunn/fzf/pull/1844#issuecomment-586663660
2 years ago
Junegunn Choi 43f0d0cacd
change-preview-window to take multiple option sets separated by '|'
So you can "rotate" through the different options with a single binding.

  fzf --preview 'cat {}' \
      --bind 'ctrl-/:change-preview-window(70%|down,40%,border-horizontal|hidden|)'

Close #2376
2 years ago
Junegunn Choi 20b4e6953e
Implement change-preview and change-preview-window actions
The new actions are named with 'change-' prefix to differentiate from
the pre-existing, one-off 'preview(...)' action.

Fix #2360
Fix #2505
Fix #2666

Related #2435
Related #2376
  - Can set up multiple bindings with different change-preview-window actions
  - Not possible to "rotate" through the options with a single binding
  - Enlarge or shrink not possible
3 years ago
Junegunn Choi 7bff4661f6
Add --header-first option to display header before prompt line
Close #2422
3 years ago
Junegunn Choi 02cee2234d
Implement --scroll-off=LINES
Close #2533
3 years ago
Junegunn Choi 97ae8afb6f
Reload should update preview window
Fix #2644
3 years ago
Junegunn Choi 0f02fc0c77
Reset {n} after reload
Fix #2611
3 years ago
Junegunn Choi 347c4b2625
Add 'unbind' action
Fix #2486
3 years ago
Junegunn Choi 4c4c6e626e
Add support for preview window header
Fix #2373

  # Display top 3 lines as the fixed header
  fzf --preview 'bat --style=header,grid --color=always {}' --preview-window '~3'
3 years ago
Junegunn Choi 4c06da8b70
Fix GitHub Action build
$USER is missing
3 years ago
yoshida.shinya 9fe2393a00
Add test cases for killing input command on terminate (#2381 #2382) 3 years ago
bitterfox 4f9a7f8c87
Don't exit fzf by SIGINT while executing command (#2375)
Fix #2374

Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
3 years ago
Junegunn Choi 76bbf57b3d
Add select and deselect actions
Close #2358
3 years ago
Junegunn Choi f55c990e86
Add `close` action
Close #2331
3 years ago
Junegunn Choi c862af09f2
Fix toggle-preview-wrap action
Fix #2336
3 years ago
Junegunn Choi e922704f72
Migrate to GitHub Actions 3 years ago
Junegunn Choi d779ff7e6d
Make search toggleable
- `--phony` renamed to `--disabled` for consistency
    - `--no-phony` is now `--enabled`
- Added `enable-search`, `disable-search`, and `toggle-search` actions
  for `--bind`
- Added `--color` options: `query` and `disabled`

Close #2303
3 years ago
Junegunn Choi 408c04f25f
Update test case for 'first' and 'last' 3 years ago
Junegunn Choi 2ec382ae0e
Add --preview-window follow option 4 years ago
Junegunn Choi cbfee31593
Fix typo in test case 4 years ago
Junegunn Choi 6d647e13ff
Add change-prompt action
Close #2270
4 years ago
Junegunn Choi a4d9b0b468
Support ANSI escape sequence for clearing display in preview window
fzf --preview 'for i in $(seq 100000); do
    (( i % 200 == 0 )) && printf "\033[2J"
    echo "$i"
    sleep 0.01
  done'
4 years ago
Junegunn Choi e2b87e0d74
Fix Travis CI build 4 years ago
Junegunn Choi 2166b4ca17
Fix test cases
We were not properly waiting for truthy-ness in until blocks.

Need Minitest with 21d9e804b6
4 years ago
Junegunn Choi d2d4d68585
Always show the number of selected entries to indicate if --multi is enabled
Close #2217

  seq 100 | fzf
    # 100/100
  seq 100 | fzf --multi
    # 100/100 (0)
  seq 100 | fzf --multi 5
    # 100/100 (0/5)
4 years ago
Junegunn Choi 92b7efafca
Ignore punctuation characters before and after preview offset column
This is to allow line numbers in a ctags output (e.g. 123;")
4 years ago
Junegunn Choi f092e4038f
Smart match of accented characters
Fix #1618
4 years ago
Junegunn Choi 0f9cb5590e
Add preview window option for setting the initial scroll offset
Close #1057
Close #2120

  # Initial scroll offset is set to the line number of each line of
  # git grep output *minus* 5 lines
  git grep --line-number '' |
    fzf --delimiter : --preview 'nl {1}' --preview-window +{2}-5
4 years ago
Junegunn Choi 17dd833925
Add preview action for --bind
Fix #2010
Fix #1638
4 years ago
Junegunn Choi a7aa08ce07
Add backward-eof event for --bind 4 years ago
Jack Bates a6d3e3687b
Improve error messages (#1962)
* Add RuboCop Minitest extension
* Improve error messages
* Use chomp option
4 years ago
Jack Bates cf04753ad7
Make flaky tests reliable (#1978) 4 years ago
Junegunn Choi dea206b023
[zsh-completion] Fix error with backslash-prefixed commands
Fix #1973
Fix #1974
Fix #1975
4 years ago
Jack Bates 5deaf58928
Run rubocop --auto-correct --disable-uncorrectable (#1967)
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
4 years ago
Junegunn Choi 540bfd7a72 [fzf-tmux] Fall back to plain fzf when split failed 4 years ago
Junegunn Choi bf65e8cd12 [fzf-tmux] Add option to start fzf in tmux popup window
Requires latest tmux built from source (e.g. brew install tmux --HEAD)

Examples:

  # 50%/50% width and height on the center of the screen
  fzf-tmux -p

  # 80%/80%
  fzf-tmux -p80%

  # 80%/40%
  fzf-tmux -p80%,40%

  # Separate -w and -h
  fzf-tmux -w80% -h40%

  # 80%/40% at position (0, 0)
  fzf-tmux -w80% -h40% -x0 -y0

You can configure key bindings and fuzzy completion to open in tmux
popup window like so:

  FZF_TMUX_OPTS='-p 80%'
4 years ago
Junegunn Choi a5c2f28539
Fix failing test case 4 years ago
Junegunn Choi 18261fe31c
[shell] Update CTRL-R to remove duplicate commands
Close #1940
Related: #1363 #749 #270 #49 #88 #492 #600
4 years ago
Chitoku 079046863c
[zsh-completion] Fix a bug where _fzf_complete did not iterate through args (#1936) 4 years ago
Junegunn Choi 373c6d8d55
Add --keep-right option to keep the right end of the line visible
Close #1652
4 years ago
Junegunn Choi b8fc828955
Fix completion test 4 years ago
Junegunn Choi 50b7608f9d
Change custom fuzzy completion API
To make it easier to write more complex fzf options. Although this
does not break backward compatibility, users are encouraged to update
their code accordingly.

  # Before
  _fzf_complete "FZF_ARG1 FZF_ARG2..." "$@" < <(
    # Print candidates
  )

  # After
  _fzf_complete FZF_ARG1 FZF_ARG2... -- "$@" < <(
    # Print candidates
  )
4 years ago
Junegunn Choi 7c40a424c0
Add retries to CTRL-R tests to avoid intermittent errors on Travis CI
- https://travis-ci.org/junegunn/fzf/jobs/659496745#L676

Related #1900
4 years ago
Junegunn Choi 99f1e02766
Fix flaky test case
Make sure that the shell is ready before hitting CTRL-R

      1) Error:
    TestFish#test_ctrl_r_multiline:
    RuntimeError: timeout
        test/test_go.rb:50:in `wait'
        test/test_go.rb:125:in `until'
        test/test_go.rb:1857:in `test_ctrl_r_multiline'
4 years ago
Junegunn Choi dd49e41c42
Ignore xterm OSC control sequences
- OSC Ps ; Pt BEL
- OSC Ps ; Pt ST

Fix #1415
4 years ago
Junegunn Choi b2c0413a98
[bash] Fix --query argument of CTRL-R
Fix #1898
4 years ago
Jack Bates e34c7c00b1
Test multi-line C-r (#1892) 4 years ago
Jack Bates 7c447bbdc7
[bash] Start C-r search with current command line (#1886)
Restore the original line when search is aborted. Add --query
"$READLINE_LINE" and fall back to the current behavior pre Bash 4.

Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
4 years ago
Junegunn Choi 7bf1f2cc84
Clean up test shell initialization
- Fix 'make docker-test'
- Set fish_history to an empty string since 'fish --private' is not
  available prior to fish 3.0
4 years ago
Junegunn Choi 2ff7db1b36
Use a more robust way to check if the shell is ready 4 years ago
James Wright 9f0626da64
Add backward-delete-char/eof action (#1891)
'backward-delete-char/eof' will either abort if query is
empty or delete one character backwards.
4 years ago
Jack Bates 9c293bb82b
[bash] Put C-t items at point in vi mode (#1876)
Be consistent with emacs mode and put the items at the point vs. the end
of the command line.
4 years ago
Hiroki Konishi 2a60edcd52
Make pointer and multi-select marker customizable (#1844)
Add --pointer and --marker option which can provide additional context to the user
4 years ago
Junegunn Choi af1a5f130b
Add clear-query and clear-selection
Close #1787
Related #1364
5 years ago
Junegunn Choi 86e3994e87 Properly clear list when --header-lines not filled on reload 5 years ago
Junegunn Choi 1e6ac5590e 'reload' action should be allowed even where there's no match
If the command template doesn't have any placeholder expressions.

    : | fzf --bind 'space:reload:seq 10'
5 years ago
Junegunn Choi d2fa470165
Add --info=STYLE [default|inline|hidden]
Close #1738
5 years ago
Junegunn Choi 05b5f3f845
'reload' action should reset multi-selection 5 years ago
Junegunn Choi 7e1c0f39e7
'reload' action should reset --header-lines 5 years ago
Junegunn Choi e975bd0c8d
Add test cases for --phony and reload action 5 years ago