zsh-users
 help / color / mirror / code / Atom feed
* java class names completion widget
@ 2006-06-05 18:40 Konstantin Sobolev
  2006-06-07 10:47 ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Konstantin Sobolev @ 2006-06-05 18:40 UTC (permalink / raw)
  To: zsh-users

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!			      


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-06-15 18:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-05 18:40 java class names completion widget Konstantin Sobolev
2006-06-07 10:47 ` Peter Stephenson
2006-06-15 15:38   ` Konstantin Sobolev
2006-06-15 16:19     ` Peter Stephenson
2006-06-15 18:41       ` Konstantin Sobolev

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).