Commit Graph

370 Commits (master)

Author SHA1 Message Date
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
Junegunn Choi 525040238e
Fix behavior of 'deselect-all' to only deselect matches
To make it consistent with select-all and toggle-all.

Close #1364
5 years ago
Junegunn Choi 11645e1fac
Fix flaky test case 5 years ago
Junegunn Choi 072066c49c
--multi to take optional argument to limit the number of selection
Close #1718
Related #688
5 years ago
Junegunn Choi a2e9366c84
Fix flaky test case 5 years ago
Simon Fraser 391669a451 Add 'f' flag for placeholder expression (#1733)
If present the contents of the selection will be placed in a temporary file,
and the filename will be placed into the string instead.
5 years ago
Junegunn Choi 8dc1377efb
Export FZF_PREVIEW_LINES and FZF_PREVIEW_COLUMNS to preview process
fzf will still override LINES and COLUMNS as before but they may not
hold the correct values depending on the default shell.

Close #1314
5 years ago
Junegunn Choi 6c32148f90
Add placeholder expression for zero-based item index: {n} and {+n}
Close #1482
5 years ago
Junegunn Choi 5d16b28869
Fix tab width after ANSI reset code in preview window
Close #1423
5 years ago
Junegunn Choi 5624a89231
Inverse-only matches should not reorder the remaining results
Fix #1458
5 years ago
Junegunn Choi 61feee690c
Render preview window when the initial query fails to match
Only if preview template contains {q}

Fix #1452
Related #1307
6 years ago
Junegunn Choi 13803d0dbb
[vim] Clear temporary window-local working directory
Close #1085
Close #1086
Close https://github.com/junegunn/fzf.vim/issues/678
6 years ago
Akinori MUSHA daa1958f86 Provide an option to reverse items only (#1267) 6 years ago
Junegunn Choi 2c26f02f5c
Improve preview window update events
- Update preview window even if there is no match for the query string
  if any of the placeholder expressions evaluates to a non-empty string.
- Also, if the command template contains {q}, preview window will be
  updated if the query string changes even though the focus remains on
  the same item.

An example:

    git log --oneline --color=always |
       fzf --reverse --ansi --preview \
       '[ -n {1} ] && git show --color=always {1} || git show --color=always {q}'

Close #1307
6 years ago
Junegunn Choi 68ec3d1c10
Fix flaky test cases 6 years ago
Junegunn Choi b877c385f0
Fix assertions in test_dynamic_completion_loader 7 years ago
Junegunn Choi d6588fc835
[bash-completion] Fix custom completion with dynamic loader enabled
After _completion_loader is called, instead of loading the entire
completion.bash file, just restore the fzf completion for the current
command. `_fzf_orig_completion_$cmd` is only set if _completion_loader
actually changed the completion options to avoid infinite loop.

Close #1170
7 years ago
Junegunn Choi 5a7b41a2cf
Add accept-non-empty action
'accept-non-empty' is similar to 'accept' (which is bound to 'enter' and
'double-click' by default) but it prevents fzf from exiting without any
selection.

Close #1162
7 years ago
Junegunn Choi c20954f020
Add replace-query action
replace-query action replaces the query string with the current
selection. If the selection is too long, it will be truncated.

If the line contains meta-characters of fzf search syntax, it is
possible that the line is no longer included in the updated result.

e.g.

  echo '!hello' | fzf --bind ctrl-v:replace-query

Close #1137
7 years ago
Junegunn Choi 1e8e1d3c9d
Fix test case on older versions of Ruby 7 years ago
Junegunn Choi f6b1962056
Inject $LINES and $COLUMNS when running preview command
Close #1168
7 years ago
Junegunn Choi 9615c4edf1
Fix test case for invalid FZF_DEFAULT_COMMAND 7 years ago
Jan Edmund Lazo 3399e39968 [vim] Escape backslashes in fzf#shellescape (#1021) 7 years ago
Junegunn Choi 6c76d8cd1c
Disallow escaping of meta characters except for spaces
https://github.com/junegunn/fzf/issues/444#issuecomment-321719604
7 years ago
Junegunn Choi 6b18b144cf
Fix escaping of meta characters after ' or ! prefix
https://github.com/junegunn/fzf/issues/444#issuecomment-321432803
7 years ago
Junegunn Choi e85a8a68d0
Allow escaping meta characters with backslashes
One can escape meta characters in extended-search mode with backslashes.

  Prefixes:
    \'
    \!
    \^

  Suffix:
    \$

  Term separator:
    \<SPACE>

To keep things simple, we are not going to support escaping of escaped
sequences (e.g. \\') for matching them literally.

Since this is a breaking change, we will bump the minor version.

Close #444
7 years ago
Junegunn Choi 999d374f0c
Fix invalid cache lookups 7 years ago
Junegunn Choi 2b98fee136
Fix Travis CI build
tcell build is commented out as it doesn't reliably respond to tmux
send-keys.
7 years ago
Junegunn Choi e5e75efebc
[vim] Fix vader test cases 7 years ago
Junegunn Choi 9d2c6a95f4
Revert "[bash] Do not append space when path completion is cancelled"
This reverts commit 376a76d1d3 as it
affects normal completion
7 years ago
Junegunn Choi 376a76d1d3
[bash] Do not append space when path completion is cancelled
Close #990
7 years ago
Junegunn Choi a0a3c349c9
Update preview window when selection has changed
Close #995
7 years ago
Junegunn Choi 6b5886c034
Adjust --no-clear option for repetitive relaunching
Related: https://gist.github.com/junegunn/4963bab6ace453f7f529d2d0e01b1d85

Close #974
7 years ago
Junegunn Choi 07ef2b051c
Print [ERROR] on info line when the default command failed
With zero result.

Related: https://github.com/junegunn/fzf.vim/issues/22#issuecomment-311869805
7 years ago
Junegunn Choi 3fc795340d
Fix test failulre with non-zero pane-base-index 7 years ago
Jan Edmund Lazo 050777b8c4 [vim] Uncomment test case to escape % in cmd.exe (#941) 7 years ago
Junegunn Choi f4731c0514
Merge branch 'master' into devel 7 years ago
Junegunn Choi 2e3dc75425
Fix inconsistent tiebreak scores when --nth is used
Make sure to consistently calculate tiebreak scores based on the
original line.

This change may not be preferable if you filter aligned tabular input on
a subset of columns using --nth. However, if we calculate length
tiebreak only on the matched components instead of the entire line, the
result can be very confusing when multiple --nth components are
specified, so let's keep it simple and consistent.

Close #926
7 years ago
Jan Edmund Lazo 8aab0fc189 [vim] Replace s:fzf_shellescape and s:shellesc with fzf#shellescape (#916) 7 years ago
Junegunn Choi 96a3250152
Update test case for --cycle 7 years ago
Junegunn Choi e1e3339770
Implement bindable "change" event and "top" action
# Move cursor to the top result whenever the query string is changed
    fzf --bind change:top

Close #925
7 years ago
Junegunn Choi 88ac397158
Add test case for --no-clear 7 years ago
Junegunn Choi c387689d1c
[shell] Enable sorting by default in CTRL-R
CTRL-R binding used to start with --no-sort to list the matched commands
in chronological order. However, it has been a constant source of
confusion. Let's enable it by default from now on. The sorted result
shouldn't be too confusing as we use --tiebreak=index.
7 years ago
Junegunn Choi cb9238dc4e
Display -S if sort is disabled and toggle-sort is used
This is to address a common confusion that one does not realize that
sorting is intentionally turned off by default and can be enabled by
a bind key.
7 years ago
Junegunn Choi e514739280
Fix failing test case 7 years ago
Junegunn Choi fe83589ade
Add test case for --tiebreak=begin 7 years ago
Junegunn Choi ed57dcb924
Extend placeholder expression for multiple selections
Close #788
7 years ago
Junegunn Choi 6a75e30941
Allow invisible preview window (--preview-window 0)
Close #820
7 years ago
Junegunn Choi e5017c0431
Remove unnecesasry test case 7 years ago
Junegunn Choi a06ccc928f
Fix flakies 7 years ago
Junegunn Choi e0036b5ad2
Add --filepath-word option
Close #802
7 years ago
Junegunn Choi 48863ac55c
Update invalid $TERM test case 7 years ago
Junegunn Choi d18b8e0d2c
Retry flaky test cases 7 years ago
Junegunn Choi 1448d631a7
Add --height option 7 years ago
Junegunn Choi 4accc69022
Fix flaky test cases 8 years ago
Junegunn Choi 898d8d94c8
Fix issues in tcell renderer and Windows build
- Fix display of CJK wide characters
- Fix horizontal offset of header lines
- Add support for keys with ALT modifier, shift-tab, page-up and down
- Fix util.ExecCommand to properly parse command-line arguments
- Fix redraw on resize
- Implement Pause/Resume for execute action
- Remove runtime check of GOOS
- Change exit status to 2 when tcell failed to start
- TBD: Travis CI build for tcell renderer
    - Pending. tcell cannot reliably ingest keys from tmux send-keys
8 years ago
Junegunn Choi 37f2d8f795
[vim] Respect g:fzf_colors
Close #711
8 years ago
Junegunn Choi 400e443a0a
Make test cases less susceptible to timeout errors 8 years ago
Junegunn Choi 0541c0dbcf
Use relative position instead of absolute distance for --tiebreak=end
Fix unintuitive result where `*fzf*/install` is ranked higher than
`fzf/src/fzf/*fzf*-linux_386` on --tiebreak=end.
8 years ago
Junegunn Choi 401a5fd5ff
Printable character in --expect set should not affect --print-query 8 years ago
Junegunn Choi 2fc7c18747
Revise ranking algorithm 8 years ago
Junegunn Choi 822b86942c
[test] Clear environment variables 8 years ago
Junegunn Choi f787f7e651
[vim] Add fzf#wrap helper function
Close #627
8 years ago
Junegunn Choi 52cf5af91c
[test] Fix test failure on Travis CI
No guarantee in the order in which files are listed
8 years ago
Junegunn Choi 05299a0fee
[test] Use tmux buffer in unicode test cases
Related #616
8 years ago
Junegunn Choi 942ba749c7
[vim] Restore working directory even when new window is opened
Close #612
8 years ago
Junegunn Choi e455836cc9
Fix race condition where preview window is not properly cleared 8 years ago
Junegunn Choi 2bbc12063c
Add --preview and --preview-window
Close #587
8 years ago
Junegunn Choi cf9c957c66
Update test_execute_shell (#590) 8 years ago
Junegunn Choi 68b60c6d19
Update test_execute_multi (#590) 8 years ago
Junegunn Choi 3a644b16a4
Update test_execute (#590) 8 years ago
Junegunn Choi c62fc5e75c
More named keys: F5 ~ F10, ALT-/ 8 years ago
Junegunn Choi 6d235bceee
Add jump and jump-accept actions for --bind
jump and jump-accept implement EasyMotion-like movement in fzf.
Suggested by @mhrebenyuk. Close #569.
8 years ago
Junegunn Choi 9078688baf Add print-query action for --bind
Close #571
8 years ago
Junegunn Choi 9bd8b1d25f
Fix typo 8 years ago
Junegunn Choi 4ab75b68dc
Fix flaky test case: test_execute
Should wait until execute action completes
8 years ago
Junegunn Choi 73cb70dbb3
Fix flaky test case: test_file_completion_unicode 8 years ago
Junegunn Choi d082cccb6d
Fix flaky test case: test_ctrl_t_unicode
The width of the pseudo-terminal on Travis CI environment can be small
and cause the line to be wrapped.
8 years ago
Junegunn Choi 988c9bd9be [zsh] Fix issues with unicode characters 8 years ago
Junegunn Choi bb70923cd8 Fix flaky test cases 8 years ago
Junegunn Choi 85ef3263fc Fix incorrect cache reference in --exact mode (#547)
When we prepend a single quote to our query in --exact mode, we are not
supposed to limit the scope of the new search to the previous
exact-match result.
8 years ago
Junegunn Choi 2f6d23b91e Enhanced ranking algorithm
Based on the patch by Matt Westcott (@mjwestcott).
But with a more conservative approach:
- Does not use linearly increasing penalties; It is agreed upon that we
  should prefer matching characters at the beginnings of the words, but
  it's not always clear that the relevance is inversely proportional to
  the distance from the beginning.
- The approach here is more conservative in that the bonus is never
  large enough to override the matchlen, so it can be thought of as the
  first implicit tiebreak criterion.
- One may argue the change breaks the contract of --tiebreak, but the
  judgement depends on the definition of "tie".
8 years ago
Junegunn Choi 5f63a7b587 Fix flaky test case 8 years ago
Junegunn Choi 444a67cafa Fix flaky test cases 8 years ago
Junegunn Choi 6cf54833f7 Fix flaky test case 8 years ago
Junegunn Choi 2ccdf21a1f Add --hscroll-off=COL option
Close #513
8 years ago
Junegunn Choi a568120e42 Fix #494 - _fzf_complete hangs on zsh when not using tmux pane 8 years ago
Junegunn Choi 30bd0b53db Fix #481 - Use $SHELL instead of sh in execute action
Note that $SHELL only points to the default shell instead of the current
shell. If you're on a non-default shell, you might want to override the
value like follows.

  SHELL=zsh fzf --bind 'enter:execute:echo $ZSH_VERSION; sleep 1'
8 years ago
Junegunn Choi 96176476f3 Make fuzzy completion customizable with _fzf_compgen_{path,dir}
Notes:
- You can now override _fzf_compgen_path and _fzf_compgen_dir functions
  to use custom commands such as ag instead of find for listing
  completion candidates.
    - The first argument is the base path to start traversal
- Removed file-only completion in bash, i.e. _fzf_file_completion.
  Maintaining a list of commands that only expect files, not
  directories, is cumbersome (there are too many) and error-prone.

TBD:
- Added $FZF_COMPLETION_DIR_COMMANDS to customize the list of commands
  which use directory-only completion. The default is "cd pushd rmdir".
  Not sure if it's the best approach to address the requirement, I'll
  leave it as an undocumented feature.

Related: #406 (@thomcom), #456 (@frizinak)
8 years ago
Junegunn Choi 45143f9541 Ignore leading whitespaces when calculating 'begin' index 8 years ago
Junegunn Choi edb647667e Change temporary file names to fix flaky tests 8 years ago
Junegunn Choi 1d2d32c847 Accept comma-separated list of sort criteria 8 years ago
Junegunn Choi 0f281ef894 [vim] Try to make 'dir' option compatible with &autochdir
When 'dir' option is passed to fzf#run(), the current working directory
is temporarily changed to the given directory, and restored at the end.
However, this behavior is not compatible with &autochdir. This commit
introduces a heuristic to determine whether or not to restore the
previous working directory.

Related: https://github.com/junegunn/fzf.vim/issues/70
8 years ago
Junegunn Choi 661d06c90a Add regression test case for #458 9 years ago
Junegunn Choi e1dd798482 [bash/zsh-completion] List hidden files as well
Close #456 and #457
9 years ago
Junegunn Choi a1b60b1d42 Fix Travis CI build
The size of pseudo-terminal in Travis CI environment can be small
9 years ago
Junegunn Choi 99ea1056ac Add --tabstop option
Related: https://github.com/junegunn/fzf.vim/issues/49
9 years ago
Junegunn Choi 7bcf4effa5 Fix test failure - use absolute path 9 years ago
Junegunn Choi 31278bcc68 Fix compatibility issues with OR operator and inverse terms 9 years ago
Junegunn Choi a89d8995c3 Add execute-multi action
Close #413
9 years ago
Junegunn Choi e99731ea85 [shell] Add FZF_ALT_C_COMMAND for ALT-C (#408) 9 years ago