From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28205 invoked from network); 5 Jun 2006 18:40:52 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.2 (2006-05-25) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.2 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 5 Jun 2006 18:40:52 -0000 Received: (qmail 58206 invoked from network); 5 Jun 2006 18:40:42 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 5 Jun 2006 18:40:42 -0000 Received: (qmail 14718 invoked by alias); 5 Jun 2006 18:40:35 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10351 Received: (qmail 14709 invoked from network); 5 Jun 2006 18:40:34 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 5 Jun 2006 18:40:34 -0000 Received: (qmail 57146 invoked from network); 5 Jun 2006 18:40:34 -0000 Received: from batman.mns.ru (80.70.224.14) by a.mx.sunsite.dk with SMTP; 5 Jun 2006 18:40:31 -0000 Received: from lan-228-198.users.mns.ru ([80.70.228.198]) by batman.mns.ru with esmtp; Mon, 05 Jun 2006 22:40:28 +0400 id 0000DCE6.44847A9C.00001A63 From: Konstantin Sobolev Reply-To: kos@supportwizard.com Organization: SupportWizard To: zsh-users@sunsite.dk Subject: java class names completion widget Date: Mon, 5 Jun 2006 22:40:27 +0400 User-Agent: KMail/1.9.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200606052240.27880.kos@supportwizard.com> Hi, I'd like to mimic IDEA's (one of Java IDEs) classes searching in zsh. It allows to find classes specifying only their names with some lower case letters ommitted. For instance, "MDCl" will match "org.bar.MyDumbClass". More strictly, each capital letter means "this letter followed by any number of lower-case letters". I've made a simple function which generates a regexp by such abbreviations: function makeClassRegexp { word=$1 res="" for (( i=1; $i<=${#word}; i++ )) { char=$word[$i] if [[ $char == *[[:upper:]]* ]] { res=${res}"([[:lower:]]*)" } res=${res}${char} } echo $res"(.*)\.java$" } Now I can easily find classes under the current dir: fcl() { regexp=`makeClassRegexp $1` find . -type f | GREPP $regexp } (where GREPP is aliased to 'grep -P' or pcregrep on different distros). kos@kos ~/work/jrs/src $ fcl SHMa ./org/kos/jrs/SoftHashMap.java Now I want to convert it into a completion widget. What is the easiest way to do it? Thanks -- /KoS * Walk softly and carry a fully charged PHASER!