From: Sebastian M. <seb...@un...> - 2008-05-14 02:14:16
|
new topic, new thread ... Am Mon, 12 May 2008 20:20:28 +0100 schrieb Nageshwar <nag...@st...>: > I think making vimplugin to use eclim is not that good idea, or > atleast following the way eclim implemented the things. Their case is > different, they have to implement each and every eclipse functionality > inside vim. Eclim people implemented the code for code completion > [abstractcompletioncommand.java i guess] and some other commands. they > also have vim scripts for displaying the data. We can just simply use > the code of the commands those we want implement. I'm trying to > implement code completion part by taking the code from the above > mentioned file. > > Correct me, if I'm wrong or if you people have some other ideas. You are completely right ... I started this mail three times, but while writing I started coding.... Now I got it running. My big mistake before were outdated docs (vim 6.4 ...). Newer vims have a :nbkey command that was new to me. Now everything makes sense (and is already implemented). We can now map any specialKey in vim to any eclipse-command fairly easy: At startup of VimConnection we add a KeyCommand2 listener which reacts to specific key events thrown by vim: This listener class has also a Handler which performs some action. One handler implementation is "HandleEclipseCommand" which just launches any eclipse command which is known by its string-id. Here a snippet from VimConnection: CommandHandler handler = new HandleEclipseCommand("org.eclipse.ui.project.buildProject"); listeners.add(new KeyCommand2("C-B",handler)); command(vimID, "specialKeys","\"C-B\""); When you type ":nbkey C-B" in vim the following happens (simplified): - vim sends a "keyAtPos XYZ" event to the socket. - vimplugin reads the event from the socket and creates a VimEvent. - all listeners are notified about that event - the KeyCommand2 from above reacts because it is configured to react to "C-B"s - the keycommand calls its handler which is the HandleEclipseCommand - the handler is configurd to exec "org.eclipse.....buildProject" - The current eclipse project is built. Current trunk can also do code-completion (details in old class KeyCommand but that's easy to reenable). I started a handler for that, but commands/handler have no parameters until now. so thats on my todo list. The other thing is to make the mapping specialKey <-> eclipse-command configurable in preferences. You see, there are a lot of open issues now, but on that basis it will be easy to go on now ... Quite excited, Sebastian. |