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

Re: Looking for a pointer on what to search for to find information on command expansion / substitution.



On Sat, Feb 25, 2023 at 7:51 PM Grant Taylor <gtaylor@xxxxxxxxxxxxxxxxxx> wrote:
>
> I had a Zsh feature configured such that I could type "sclient<space>"
> and it ZLE (?) would replace that with "openssl s_client".

My best guess is that you had the following snippet in .zshrc that
you'd copied from zshwiki.org:

    typeset -gA abbreviations=(
      'sclient' 'openssl s_client'
    )

    magic-abbrev-expand() {
        emulate -L zsh -o extended_glob
        local MATCH
        LBUFFER="${LBUFFER%%(#m)[_a-zA-Z0-9]#}"
        LBUFFER+="${abbreviations[$MATCH]:-$MATCH}"
        zle self-insert
    }

    no-magic-abbrev-expand() {
        LBUFFER+=' '
    }

    zle -N magic-abbrev-expand
    zle -N no-magic-abbrev-expand
    bindkey ' ' magic-abbrev-expand
    bindkey '^x ' no-magic-abbrev-expand

Roman.




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