Extending Eclipse's JavaEditor (to act like Vim/change KeyListener)
-
20-08-2019 - |
Question
Introduction a.k.a. what do I intend to do
feel free to skip this part, no real information is comprised in here
Because of the lack of a good, free (as in speech) vim
-Mode for the otherwise excellent JavaEditor in Eclipse(3.4), I'm thinking about writing one. The available solutions are:
- ViPlugin: commercial and not good (e.g. no
vim
text-objects
, such asdaW
) - VimPlugin: new editor, not the power of the built in JavaEditor
- see SO: Painless integration of Eclipse with Vim? : nothing really good turned up
(However feel free to mention other solutions than the ones above which could help me.)
In my opinion, it's the wrong way of writing a completely new editor based on TextEditor
, because you will then loose the cool features the standard JavaEditor gives you for free (such as 'organize imports', 'refactor menu', ...).
I'm thinking of a 'skin' to the normal JavaEditor which behaves like vim
, everything else should be unchanged.
Now the questions
- How can I detect if a
IWorkbenchPart
given byIPartListener.partActivated()
is the JavaEditor? - How can I then replace JavaEditor's
KeyListener
; something like theITextViewerExtension.prependVerifyKeyListener
is needed? - Is this a good way to go on?
Solution
I am the developer of something you might be looking for. It is still under heavy development and does not have all features you are looking for, but I am working hard on it and I am always open for feature and enhancement requests.
The plugin is called Vrapper. It is FOSS and follows the principles you describe, although I don't think it is much more powerful than the ViPlugin at the moment. But as I said, I am constantly working on it and try to respond fast to feature requests. :-)
OTHER TIPS
I use the VI plugin from here (note: this link is down as of the time of writing and I'm hoping it'll be back soon). This works very well indeed and ties in very well with the coding/refactoring capabilities of Eclipse (see this answer).
So you may want to try that link (if it comes up!) before you embark on engineering your own solution :-)
I try Vrapper, it's comfortable. got vim function in eclipse, naver lost original function