fzf/shell
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
2015-10-05 01:48:45 +09:00
..
completion.bash [zsh-completion] Allow custom completion function 2015-10-05 01:48:45 +09:00
completion.zsh [zsh-completion] Allow custom completion function 2015-10-05 01:48:45 +09:00
key-bindings.bash [bash] Make CTRL-R work when histexpand is unset (#286) 2015-07-13 00:22:13 +09:00
key-bindings.fish fix fish streams 2015-08-30 14:05:24 +02:00
key-bindings.zsh Remove dependency on zsh/pcre module 2015-10-01 15:18:10 -04:00