Commit Graph

304 Commits (8d4d184fc6e7b1378e8aceb6318d75a73478c74a)

Author SHA1 Message Date
Junegunn Choi 6cbde812f6
[bash] Add code to the default list of programs to support completion
Close #3843
3 months ago
Junegunn Choi 3b2e932c13
Bind CTRL-/ and ALT-/ to toggle-wrap by default 3 months ago
Junegunn Choi b44ab9e33c
[completion] Use --wrap option in process completion
And remove the short preview window for showing the whole command.

Because it is important to be able to see the whole command before
deciding to kill it.
3 months ago
Junegunn Choi 23a391e715
[zsh] Fix backslash escaping (#3909)
Fix #3859

To test:

  FZF_CTRL_T_COMMAND="echo -E 'foo\bar\baz'; echo -E 'hello\world'"

  _fzf_compgen_path() {
    eval $FZF_CTRL_T_COMMAND
  }

  source shell/key-bindings.zsh
  source shell/completion.zsh
4 months ago
LangLangBart e1fcdbc337
fix(zsh): use the '=~' operator instead of grep (#3906) 4 months ago
Junegunn Choi a06745826a
[zsh] Fix completion error on openSUSE Tumbleweed
Fix suggested by @LangLangBart

Fix #3890
4 months ago
林千里 e9e0011f1d
fix zsh ${(@)history} syntax does not work with ksh_arrays (#3893)
When `setopt ksh_arrays` in zsh, `${(@kv)history}` gives only the first entry rather than all.
4 months ago
LangLangBart db01e7dab6
fix(zsh): add (s) modifier to perl command (#3882) 4 months ago
Hexin 61ae9d75b6
Remove comment in command substitution (#3875) 4 months ago
LangLangBart 22adb6494f
chore(shell): Separate declaration and assignment for zsh legacy versions (#3856) 4 months ago
Samara Jinnah e023736c30
[zsh] Prevent glob expansion in history widget (#3855) 4 months ago
ismay 144d55a5be
[fish] Merge history before searching (#3852)
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
4 months ago
Junegunn Choi 4c83d8596d
Add new options to bash completion 5 months ago
LangLangBart dbe8dc344e
[fish] Use builtins for cd and history (#3830)
Close #3826
5 months ago
LangLangBart 2b6d600879
[zsh] Enhance CTRL-R to display multi-line entires (#3823)
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
5 months ago
Junegunn Choi 05c765d442
[fish] Add --nth 2..,.. to allow anchored search against command 5 months ago
Junegunn Choi 7405925952
[bash] Indent multi-line history entries 5 months ago
Junegunn Choi 3afd543a7e
[fish] Use perl instead of sed to strip leading tabs
https://github.com/junegunn/fzf/pull/3807#discussion_r1619520105
5 months ago
Junegunn Choi b4f2cde5ac
[fish] Better multi-line support for CTRL-R
Prepend each entry with an index number so that multi-line entries can
be clearly distinguished.
5 months ago
Junegunn Choi ed53ef7cee
[shell] Add --highlight-line to CTRL-R bindings 5 months ago
LangLangBart 07880ca441
chore: Update flags to include long-form options for case (#3785) 5 months ago
Junegunn Choi cd8d736a9f
[shell] Add $FZF_COMPLETION_{DIR,PATH}_OPTS
To allow separately overriding 'walker' options.

Close #3778
5 months ago
Junegunn Choi 7f85beccb5
[completion] Add undocumented bash variables for completion commands
And allow empty FZF_COMPLETION_DIR_COMMANDS
6 months ago
Junegunn Choi 767f1255ab
Make completion.bash load faster
* Reduce number of `__fzf_orig_completion < <(complete -p "$@" 2> /dev/null)`s
* Clean up options in fzf completion
* Remove telnet completion
6 months ago
Junegunn Choi f864f8b5f7
Respect $FZF_DEFAULT_OPTS_FILE in key bindings and completion (#3742)
Fix #3740
6 months ago
LangLangBart d169c951f3
fix: Move 'emulate' command outside interactive check (#3736) 6 months ago
Junegunn Choi 152988c17b
[shell] Revert interactiveness checks for eval
So that there's no error even when the scripts are mistakenly evaluated
in non-interactive sessions.

  bash -c 'eval "$(fzf --bash)"; echo done'
  zsh -c 'eval "$(fzf --zsh)"; echo done'

* https://github.com/junegunn/fzf/pull/3675#issuecomment-2044860901
* f103aa4753
6 months ago
Junegunn Choi 118b4d4a01
[bash] Add -o nospace to dir completion options (#1987) 7 months ago
Junegunn Choi da14ab6f16
[bash] Remove -o default from dir completion options (#1987) 7 months ago
Junegunn Choi 09a4ca6ab5
[bash] Fix variable completion of directory-related commands
Fix #1987
7 months ago
Junegunn Choi 128e4a2e8d
[fish] Fix $dir in FZF_{CTRL_T,ALT_C}_COMMAND not evaluated
Fix #3705
7 months ago
Emilio Vesprini 7de87a9b2c
[shell] Make ALT-C use the absolute path to the selected directory (#3688)
Rationale: this way the resulting cd command that ends up in the shell
history can be reused to get to the same location regardless of
the current working directory.

Co-authored-by: LangLangBart <92653266+LangLangBart@users.noreply.github.com>
7 months ago
Junegunn Choi dff865239a
[bash-completion] Make dynamic loader return 124 to retry completion
Close #3702
7 months ago
zeertzjq 25e61056b6
[fish] Fix Ctrl-T and Alt-C not using last token as search root (#3684) 7 months ago
Eli Barzilay 88f4c16755
Make it possible to disable `Ctrl+T` / `Alt+C` / completions (#3678)
This makes it possible to skip one of the above key bindings or
completions by setting a variable to an empty string. For example,

    FZF_CTRL_T_COMMAND= FZF_ALT_C_COMMAND= \
      eval "$(fzf --zsh)"

Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
7 months ago
Junegunn Choi 0740ef7ceb
[bash] Fix default completion of unset, unalias, etc
Fix #3679
7 months ago
Junegunn Choi d282a1649d
Add walker options and replace 'find' with the built-in walker (#3649) 7 months ago
Junegunn Choi 6ce8d49d1b
[bash] Fix regression in dynamic completion
Fix #3674
7 months ago
Koichi Murase 01871ea383 [bash] Update orig_complete after _completion_loader 7 months ago
Koichi Murase 1dbdb9438f [bash] Refactor access to "_fzf_orig_complete_${cmd//[^A-Za-z0-9_]/_}"
In the current codebase, for the original completion settings, the
pieces of the codes to determine the variable name and to access the
stored data are scattered.  In this patch, we define functions to
access these variables.  Those functions will be used in a coming
patch.

* This patch also resolves an inconsistent escaping of "$cmd": $cmd is
  escaped as ${...//[^A-Za-z0-9_]/_} in some places, but it is escaped
  as ${...//[^A-Za-z0-9_=]/_} in some other places.  The latter leaves
  the character "=" in the command name, which causes an issue because
  "=" cannot be a part of a variable name.  For example, the following
  test case produces an error message:

  $ COMP_WORDBREAKS=${COMP_WORDBREAKS//=}
  $ _test1() { COMPREPLY=(); }
  $ complete -vF _test1 cmd.v=1.0
  $ _fzf_setup_completion path cmd.v=1.0
  $ cmd.v=1.0 [TAB]
  bash: _fzf_orig_completion_cmd_v=1_0: invalid variable name

  The behavior of leaving "=" was present from the beginning when
  saving the original completion is introduced in commit 91401514, and
  this does not seem to be a specific reasoning.  In this patch, we
  replace "=" as well as the other non-identifier characters.

* Note: In this patch, the variable REPLY is used to return values
  from functions.  This design is to make it useful with the value
  substitutions, a new Bash feature of the next release 5.3, which is
  taken from mksh.
7 months ago
Junegunn Choi e90bb7169c
[zsh] Handle '*' suffix in history line numbers
Fix #3591
9 months ago
danztran 2671259fdb
[zsh] Make CTRL-R compatible with accept-or-print-query (#3557)
Fix #3556

Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
10 months ago
akdevservices a62fe3df6f
[completion] Handle all hostaliases in /etc/hosts (#3495)
* Fix #3488
* Handle inline comments in hosts file
12 months ago
Junegunn Choi 70c461c60b
[bash] Preserve existing completion for ssh
Fix #3484
1 year ago
LangLangBart 3e1735b06e
[zsh] Fix 'emulate: unknown argument -o' error on old zsh (#3465)
Fix #2094
1 year ago
Christoph Anton Mitterer 7e89458a3b
[fish] exit as well when called from non-interactive shell (#3467)
Just like with the other shells, exit fish to, if called from a non-interactive
shell.

We cannot use `return`, as older versions of fish (namely < 3.4.0) did not
support to use `return` in `.`-scripts (this was only added with fish commit
3359e5d2e9bcbf19d1652636c8e448a6889302ae).

Unlike in POSIX, fish’s `exit` is however documented to no cause the calling
shell to exit when executed in a sourced script (see:
0f70b2c0d3/doc_src/cmds/exit.rst?plain=1#L20
)

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
1 year ago
Junegunn Choi f212bafe46
[bash] Remove implicit bash-completion dependency 1 year ago
Christoph Anton Mitterer 86fe40708b [bash] statically define __fzf_list_hosts() with either method
When bash-completion (and thus `_known_hosts_real()`) is / is not available this
will typically not change during the lifetime of a shell.

The only exception is if the user would unset `_known_hosts_real()`, but well,
that would be his problem.

So we can easily define `__fzf_list_hosts()` either using `_known_hosts_real()`
or using the old code, and avoid checking every time whether
`_known_hosts_real()` is defined.

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
1 year ago
Christoph Anton Mitterer d718747c5b [bash] try to use bash-completions’s _known_hosts_real() for getting hostnames
If defined, use bash-completions’s `_known_hosts_real()`-function to create the
list of hostnames.
This obviously requires bash-completion to be sourced before fzf.

If not defined, fall back to the previous code.

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
1 year ago
Christoph Anton Mitterer 46ee9ac41c [shell] make `__fzf_list_hosts()` definable by the user
Just like it’s already done for `_fzf_compgen_path()` and `_fzf_compgen_dir()`
allow a user to easily define his own version of `__fzf_list_hosts()`.

Also add some documentation on the expected “interface” of such custom function.

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
1 year ago