Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Completion of CLI parameters



On Thu, 29 Apr 2004 14:59:58 +0000,  wrote:

>On Apr 29,  1:56pm, Peter Stephenson wrote:
>}
>} autoload -U insert-args-of
>} zle -N insert-args-of
>} bindkey '^x^a' insert-args-of
>
>Oliver would say this was crying out to be a _generic completer; here's
>a trivial stab at one.  However, the right thing would be for _expand to
>recognize a zstyle -- perhaps named "expander" -- that would supply a
>function to produce expansions, and to try calling that before falling
>back on the usual shell expansions.  That way we'd get the full power of
>all the other styles recognized by _expand.
>
>The following suffers from the usual problems of menus that may contain
>multi-line structures, I haven't done anything to address that.
>
>#autoload
># Name this file expand-args-of and place it in a $fpath directory, and
># then add these commands to .zshrc:
>#  zle -C expand-args-of complete-word _generic
>#  zstyle ':completion:expand-args-of::::' completer expand-args-of
>#  bindkey '^x^a' expand-args-of
>
>local pat=$words[CURRENT]
>local -a exp
>
>if ((CURRENT > 1))
>then
>  # Remove the first * here to match on command name only
>  exp=( $history[(R)*${(q)pat}*] )
>  exp=( ${exp#*[[:space:]]} )
>else
>  exp=( $history[(R)${(q)pat}*] )
>fi
>compadd -UQ -a exp
>compstate[insert]=menu
>
>#end of expand-args-of

This one just beeps at me?!?

zzapper (vim, cygwin, wiki & zsh)
--

vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?"

http://www.vim.org/tips/tip.php?tip_id=305  Best of Vim Tips



Messages sorted by: Reverse Date, Date, Thread, Author