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

Re: Completing all possible candidates



Great thanks, Bart! That worked very well. If anyone else is interested,
here's my result:

_my-prev-result() {
    local hstring
    if [[ $WIDGET = *-all-* ]]; then
        compstate[insert]=all
    fi
    # Run last command again, save output in hstring
    hstring=$(eval $(fc -l -n -1))
    # Split items on new-line into an array, quote each item
    compadd - ${(@f)hstring}
}

zle -C my-prev-comp menu-complete _my-prev-result
bindkey '\ee' my-prev-comp

zle -C my-all-prev-comp complete-word _my-prev-result
bindkey '^xE' my-all-prev-comp




On Fri, Jan 11, 2013 at 3:32 PM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>wrote:

> On Jan 11, 12:30pm, Jesper Nygårds wrote:
> }
> } Simply stated, I want a key that says: "run the previous command line,
> and
> } put all the resulting output on the command line". How to do this?
>
> Take a look at Functions/Zle/keeper in the distributed set of examples.
> It doesn't capture the same results that you are looking for, but it
> has functions for copying those results to the command line.
>


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