Commit Graph

97 Commits (master)

Author SHA1 Message Date
Sam Van Den Berge 2ba10071c9 Add support for IPv6 addresses in ssh completion (#877)
Signed-off-by: Sam Van Den Berge <sam@drgt.net>
7 years ago
Junegunn Choi 337cdbb37c
[zsh] Use setopt noposixbuiltins instead of emulate -L zsh
Close #858
3a6af27586 (commitcomment-21135641)
7 years ago
Junegunn Choi 05fdf91fc5
Revert "[zsh] emulate -L zsh to avoid issues with incompatible options"
This reverts commit 3a6af27586.
7 years ago
Junegunn Choi 3a6af27586
[zsh] emulate -L zsh to avoid issues with incompatible options
Close #858
7 years ago
Junegunn Choi 44d3faa048
[completion] Restore --height option for kill completion 7 years ago
Junegunn Choi 208d4f2173
[shell] Make layout configurable via $FZF_DEFAULT_OPTS and $FZF_{KEY}_OPTS 7 years ago
Junegunn Choi dc3957ce79
[completion] Add preview window to kill completion 7 years ago
Junegunn Choi 5b68027bee
Fix $FZF_COMPLETION_OPTS evaluation
Close #799
7 years ago
Junegunn Choi 1448d631a7
Add --height option 8 years ago
Junegunn Choi fd137a9e87
[bash/zsh-completion] Filter ~/.ssh/known_hosts
Close #791
8 years ago
Niraj Thapaliya d3da310b92 Use `command` to ignore shell function 8 years ago
Niraj Thapaliya 93e0a6a9de Gnu `[` evaluates both sides of a -o condition regardless
It doesn't short circuit like we expect, causing trouble when $dir is
empty

Use shell builtin instead
8 years ago
Tobias Frilling 639de4c27b Split default zsh binding at the correct place
The command substitution and following word splitting to determine the default
zle widget for ^I formerly only works if the IFS parameter contains a space. Now
it specifically splits at spaces, regardless of IFS.
8 years ago
Junegunn Choi 6a52f8b8dd
[zsh-completion] setopt localoptions noksh_arrays
Close #607
8 years ago
Junegunn Choi 6081eac58a
[shell] Suppress alias/function expansion
Close #611
8 years ago
Sebastian Reuße fed5e5d5af [zsh] Re-initialize zle when widgets finish
zle automatically calls zle-line-init when it starts to read a new line. Many
Zsh setups use this hook to set the terminal into application mode, since this
will then allow defining keybinds based on the $terminfo variable (the escape
codes in said variable are only valid in application mode).

However, fzf resets the terminal into raw mode, rendering $terminfo values
invalid once the widget has finished. Accordingly, keyboard bindings defined
via $terminfo won’t work anymore.

This fixes the issue by calling zle-line-init when widgets finish. Care is taken
to not call this widget when it is undefined.

Fixes #279
8 years ago
Aleks Kamko 19339e3a6d optimize fzf_default_completion binding 8 years ago
Junegunn Choi 923feb69ab
[zsh] Fix indentation 8 years ago
Jim Howell b8a3ba16a2
[bash/zsh] Take SSH completion hints from known_hosts
Signed-off-by: Junegunn Choi <junegunn.c@gmail.com>
8 years ago
Junegunn Choi bdb94fba7d
[zsh] Fix #579 - Locally unset globsubst 8 years ago
Junegunn Choi 988c9bd9be [zsh] Fix issues with unicode characters 8 years ago
Junegunn Choi 935e986be5 [zsh] Remove unnecessary evals 8 years ago
Junegunn Choi 26b9100709 Minor code cleanup 8 years ago
Junegunn Choi a568120e42 Fix #494 - _fzf_complete hangs on zsh when not using tmux pane 8 years ago
Junegunn Choi 82067463b8 [completion] _fzf_complete_COMMAND_post for post processing
e.g.

_fzf_complete_foo() {
  _fzf_complete "--multi --reverse --header-lines=3" "$@" < <(
    ls -al
  )
}

_fzf_complete_foo_post() {
  awk '{print $NF}'
}

[ -n "$BASH" ] && complete -F _fzf_complete_foo -o default -o bashdefault foo
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
Kobe Lipkens 6208fc9cfd Fix autocompletion for absolute paths 9 years ago
Junegunn Choi e1dd798482 [bash/zsh-completion] List hidden files as well
Close #456 and #457
9 years ago
Daniel Hahler 701687faab zsh: fzf-completion: use noshwordsplit local option
This also fixes the completion causing a bell / flickering in case
"shwordsplit" was not set, because then the function would return false.
9 years ago
Daniel Hahler 95c69083c7 zsh completion: use \grep to skip any alias 9 years ago
Junegunn Choi eee45a9578 [completion] Revamp completion API
* _fzf_complete is the helper function for custom completion
    * _fzf_complete FZF_OPTS ARGS
    * Reads the output of the source command instead of the command string
    * In zsh, you can use pipe to feed the data into the function, but
      it's not possible in bash as by doing so COMPREPLY is set from the
      subshell and thus nullified
* Change the naming convention for consistency:
    * _fzf_complete_COMMAND

e.g.

  # pass completion suggested by @d4ndo (#362)
  _fzf_complete_pass() {
    _fzf_complete '+m' "$@" < <(
      local pwdir=${PASSWORD_STORE_DIR-~/.password-store/}
      local stringsize="${#pwdir}"
      find "$pwdir" -name "*.gpg" -print |
          cut -c "$((stringsize + 1))"-  |
          sed -e 's/\(.*\)\.gpg/\1/'
    )
  }

  # Only in bash
  complete -F _fzf_complete_pass -o default -o bashdefault pass
9 years ago
Junegunn Choi 8fa9e85980 [zsh-completion] Allow custom completion function
While in bash you can externally register custom completion functions
using `complete` command, it was not possible to do so in zsh without
changing completion.zsh as the name of the supported commands are
hard-coded within the code (See #362). With this commit, fzf-completion
of zsh will first look if `_fzf_COMMAND_completion` exists and calls the
function, so one can externally define completion functions for specific
commands.

This commit also tries to make the interface of (yet undocumented)
_fzf_list_completion helper function consistent across bash and zsh.

So the following code works both on bash and zsh.

    _fzf_pass_completion() {
      local pwdir=${PASSWORD_STORE_DIR-~/.password-store/}
      local stringsize="${#pwdir}"
      let "stringsize+=1"
      _fzf_list_completion '+m' "$@" << "EOF"
        find "$pwdir" -name "*.gpg" -print | cut -c "$stringsize"- | sed -e 's/\(.*\)\.gpg/\1/'
    EOF
    }

    # Only on bash
    complete -F _fzf_pass_completion -o default -o bashdefault pass

Note that the suggested convention and the interface are not yet final
and subject to change.

/cc @d4ndo
9 years ago
Junegunn Choi 5660cebaf6 [zsh-completion] Temporarily unset shwordsplit (#328) 9 years ago
Junegunn Choi cca543d0cd [zsh-completion] Fix #236 - zle redisplay 9 years ago
Junegunn Choi 26d2af5ee8 [zsh-completion] Respect backslash-escaped spaces (#230) 9 years ago
Junegunn Choi 2b61dc6557 [zsh-completion] Do not overwrite $fzf_default_completion 9 years ago
Junegunn Choi 0b770cd48a [zsh-completion] Remember what ^I was originally bound to (#230) 9 years ago
Junegunn Choi c14aa99ef6 [zsh/bash-completion] Avoid caret expansion
Close #233

setopt extendedglob on zsh caused caret in grep pattern to be expanded.
Problem identified and patch submitted by @lazywei.
9 years ago
Junegunn Choi 8f371ee81c [zsh-completion] fzf-zsh-completion -> fzf-completion 9 years ago
Junegunn Choi 3b63b39810 [zsh-completion] Allow empty prefix & trigger sequence (#232) 9 years ago
Tiziano Santoro 0cd238700c [zsh-completion] Add comment clarifying trigger expansion. (#230) 9 years ago
Tiziano Santoro 14fbe06d9e [zsh-completion] Allow specifying empty completion trigger. (#230) 9 years ago
Junegunn Choi 207aa07891 [zsh-completion] Temporarily set nonomatch (#230)
No error on ~INVALID_USERNAME**<TAB>
9 years ago
Junegunn Choi 26a141c6a6 [zsh-completion] Fix `~USERNAME**` (#230) 9 years ago
Junegunn Choi dc64568c83 [zsh-completion] Completion for unknown commands 9 years ago
Junegunn Choi 5a17a6323a [zsh-completion] "\find" to bypass alias 9 years ago
Junegunn Choi 2b8e445321 Fuzzy completion for zsh (#227) 9 years ago