[arch-projects] New small project proposition
So, I always screw myself up when using vim - I work professionally using VS.NET, and there's alot of features that are real nice... most can be worked into vim somehow (for instance, the way the HOME key will toggle between column 0 and the first non-whitespace char). The only one I miss is the context-sensitive completion of VS.NET... Now I'm not talking about a little popup window with all the accessability and things like that... I'm just looking for <C-N> and <C-P> to complete within the context of the class/struct/union... I've looked a bit into some of the plugins that vim has right now and most of them suck. There are 3 though, that I cannot test yet... 2 are ruby-based, another perl-based... stupid win32 and their paths and grrr... "cannot load library perl58.dll, aborting" I give up... Anyway, what I'd like to do is create a little stand alone app that could very easilly be integrated into vim, or anything else... seeing as I like to think from the outside inward, here's the interface I have in my head: $ findsyms "XCreateSimpleW" /usr/include/X11/Xlib.h XCreateSimpleWindow $ findsyms --signature "signal5::conn" /usr/include/sigc++ void sigc::signal5::connect(const slot5&) $ cat "my_file.c" | findsyms --signature "foo" bool foo(int,int) $ findsyms "java.lang.String" /path/to/java/jar ...list all public String members... # from vim: :!findsyms <cword> % "well, not exactly... I'd need to get the type of a variable in the case of OO simple: scan file + included files for matching definitions basically, if finds matching patterns... not too hard... ideally, I'd go really generic and create language files to describe what each scope looks like, what an include file looks like, and how to determine if something is visible at that scope of not c++ would be rough when you get into templates (that sigc:: one would fail unless it ignores templates), but c would be easy, as would things like python... and maybe perl I want to be able to use this in vim somehow as a dict file... Now I may be way off with this, and there may be a simple way to do it *within* vim... but I don't know... Anyone have any opinions? Feel free to debase me or whatever... or suggest a language that would do this easiest... just really thinking outloud today
I have no idea in vim. Context-sensitive completion is the one thing I miss in JEdit from Netbeans too. 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? 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. Is this what you're looking at too? Dusty On Apr 8, 2005 4:27 PM, Aaron Griffin <aaronmgriffin@gmail.com> wrote:
So, I always screw myself up when using vim - I work professionally using VS.NET, and there's alot of features that are real nice... most can be worked into vim somehow (for instance, the way the HOME key will toggle between column 0 and the first non-whitespace char). The only one I miss is the context-sensitive completion of VS.NET...
Now I'm not talking about a little popup window with all the accessability and things like that... I'm just looking for <C-N> and <C-P> to complete within the context of the class/struct/union...
I've looked a bit into some of the plugins that vim has right now and most of them suck. There are 3 though, that I cannot test yet... 2 are ruby-based, another perl-based... stupid win32 and their paths and grrr... "cannot load library perl58.dll, aborting" I give up...
Anyway, what I'd like to do is create a little stand alone app that could very easilly be integrated into vim, or anything else... seeing as I like to think from the outside inward, here's the interface I have in my head:
$ findsyms "XCreateSimpleW" /usr/include/X11/Xlib.h XCreateSimpleWindow $ findsyms --signature "signal5::conn" /usr/include/sigc++ void sigc::signal5::connect(const slot5&) $ cat "my_file.c" | findsyms --signature "foo" bool foo(int,int) $ findsyms "java.lang.String" /path/to/java/jar ...list all public String members... # from vim: :!findsyms <cword> % "well, not exactly... I'd need to get the type of a variable in the case of OO
simple: scan file + included files for matching definitions
basically, if finds matching patterns... not too hard... ideally, I'd go really generic and create language files to describe what each scope looks like, what an include file looks like, and how to determine if something is visible at that scope of not
c++ would be rough when you get into templates (that sigc:: one would fail unless it ignores templates), but c would be easy, as would things like python... and maybe perl
I want to be able to use this in vim somehow as a dict file...
Now I may be way off with this, and there may be a simple way to do it *within* vim... but I don't know...
Anyone have any opinions? Feel free to debase me or whatever... or suggest a language that would do this easiest... just really thinking outloud today
_______________________________________________ arch-projects mailing list arch-projects@archlinux.org http://archlinux.org/mailman/listinfo/arch-projects
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( exactly
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 $WHATEVER/perl/site/lib/Search/Tags.pm -> 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 complicated... this vim script does something similar for only python... I might tear away at it's internals... http://vim.sourceforge.net/scripts/script.php?script_id=1074 (there's some screenshots in the download section)
Is this what you're looking at too? yup
On Fri, 2005-04-08 at 17:27 -0500, Aaron Griffin wrote:
Now I'm not talking about a little popup window with all the accessability and things like that... I'm just looking for <C-N> and <C-P> to complete within the context of the class/struct/union...
I haven't used vim, except tried few times. What I don't like with CLI's in general, when needed to remember command words/options or scroll a long man page or --help. I got the dislike of memorising bunch of options from WordPerfect in its early days. Don't think I was the only one. Nano I like when having the two line menu at the bottom. If you are suggesting a popup window to see the options, I like the idea. Markku (rasat)
If you are suggesting a popup window to see the options, I like the idea.
well, yes it could be used that way - for vim, I was thinking of using the same window that pops up when you use :make - there's a temp window at the bottom with errors....
participants (3)
-
Aaron Griffin
-
Dusty Phillips
-
Rasatmakananda