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

Re: A weird smart-insert-last-word bug



On Fri, Nov 2, 2018 at 5:37 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
wrote:

> Sorry, what is "zlewidget" exactly?
>

Oops. I got it from Peter a long time ago:
https://www.zsh.org/mla/users/2014/msg00270.html

My version has been modified to allow an empty KEY value to be able to
avoid the bindkey at the end:

function zlewidget # KEY WIDGET [FUNCTION]
{
    # bindkey KEY to new WIDGET, possibly implemented by optional FUNCTION.
    # FUNCTION defaults to WIDGET and will be marked for autoload -Uz.
    # If KEY is an empty string, the bindkey call is skipped.
    local key=$1
    local widget=$2
    local func=${3:-$2}

    autoload -Uz $func
    zle -N $widget $func
    [[ -z $key ]] || bindkey $key $widget
}

Does this help? [... patch elided ...]
>

Yup, that works well for me. Thanks!

..wayne..


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