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

Re: completions issues



On Jul 14, 12:55pm, GoTaR wrote:
} Subject: Re: completions issues
}
} On Sat, Jul 13, 2002 at 21:20:37 +0000, Bart Schaefer wrote:
} 
} > } And question: how to make it without perl?
} > 
} >     smsas=( ${(f)$(smsaddr -l)} )
} 
} Here is the first trap - ${(f)... will change double tab to space

That has nothing to do with ${(f)...}.  It's just that I lost the double
quotes somehow when typing my reply:

	smsas=( ${(f)"$(smsaddr -l)"} )

Elsewhere, you wrote:

} No no no, adding both will cause showing them _all_ when completion
} without any prefix - and I don't want doubled entries like this:
} 
} gotar:~: smsaddr -l [tab]
} SMS alias
} rtrzepla -- 692xxx
} 692xxx   -- rtrzepla

Getting a little demanding, aren't we?

Anyway, just add the inverted pairs only when the word on the line is
non-empty, and then let completion deal with it from there.

  _sms_aliases () {
    smsas=( ${(f)"$(smsaddr -l)"} )
    smsas=( ${smsas/		/:} )
    if [[ -n "$PREFIX$SUFFIX" ]]; then
      smsas=( ${smsas/(#s)(#b)(*)		(*)(#e)/$match[2]:$match[1]} )
    fi
    _describe "SMS alias" smsas
  }


-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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