[arch-projects] New small project proposition

Aaron Griffin aaronmgriffin at gmail.com
Fri Apr 8 18:56:04 EDT 2005

> Under JEdit, there's an option to complete a word based on all other
> words in the currently open file. I'm certain vim has this already too
> -- is that what Ctrl-n and Ctrl-p do by default?
Yup, well, you can change how it searches... like set it up so it
searches included files (and java import statements are parsed to work
the same way... java.lang.blah is parsed into
$WHATEVER/java/lang/blah.java) but scanning included files takes a
long time (I checked once, and including 3 normal headers cascaded to
something like 82 included files it needed to search)... and it still
doesn't do it based on context... just alphabetically.

> However, it would be nice to have something context sensitive. So if I have:
> String myStr;
> String clip = myStr.su
> it will automatically complete to myStr.subString(

> For that to work, it has to be language aware, both for syntax, and
> for available libraries. Trying to get that to work across all
> languages would be really difficult... not impossible.
not *fully* language aware... off the top of my head, it'd need to know:

how libraries are included and how they're found when run
   -> perl: use Search::Tags; means it's in
   -> python: import os; means $WHATEVER/python2.4/site-packages/os.py
   -> etc

what defines a "scope"
   -> java, c, c++, ruby(?), etc: { and }
   -> python: indentation

what ends or continues a line:
   -> java, c, blah blah blah: line ends at ;

display of output:
   -> c++: namespace::class::member
   -> java: namespace.class.member

you could define all these little things as regex's in a language
file... c.language, python.language, java.language... and then use the
file extension to determine the language.... vim does something
similar to this internally.... but vim script is really ugly and

this vim script does something similar for only python... I might tear
away at it's internals...
(there's some screenshots in the download section)

> Is this what you're looking at too?

More information about the arch-projects mailing list