Is there a vim plugin for eclipse that let me remap jj to Esc? - eclipse

I am looking for an eclipse plugin that gives me basic vim commands.
I don't expect to much but I'm so used to 'jj' for escape that this feature is essential for me. 'jj' should work like in vim: Leave insert mode but don't insert any characters.
I'm considering
viplugin
vrapper
viable
vimplugin
eclim
but didn't find much information if it is possible to remap anything to ESC.
With viplugin it seems possible to do that, but when remapping 'jj'
it still inserts 'jj'. Eclim should support it, but it's probably to heavy.

You can customize vrapper's behaviour with a vimrc-like file: ~/.vrapperrc. It works like ~/.vimrc syntax-wise but you are quite limited in what you can put there.
inoremap jj <ESC>
does exactly what you want, though, just like in Vim.

What worked for me:
Make sure your .vrapperrc is in what Eclipse has as your user director. A quick google gave this:
"If you go to Help > About > Installation Details > Configuration tab, can you check if the directory listed next to user.home is the one your .vrapperrc is in?"
Add this line to the .vrapperrc:
imap jj <ESC>
'inoremap' didn't seem to work for me, but that might have been because of some other issue.
Restart Eclipse and profit.

Related

Eclipse vrapper undo

I use Eclipse for programming in almost any language. I also like the vim shortcuts for quick editing so I installed vrapper.
The problem is when I write a lot of code, and I just want to undo some little things. It undos a lot of chunks of code back, instead of 2 or 3 little things.
I've found some threads which seem to resolve my issue by using "set noati", but it does nothing. It doesn't matter if I use "Ctrl+Z" or "u" from vim command mode.
Can someone please help me to resolve this issue ?
The set noati seems to be the solution for that (at least was for me and other people in vrapper forums)... simply to update to the latest version of vrapper then you either specific the set noati (no ":" here!) in the ".vrapperrc" (this config file should be placed in your home directory) or you simply run the :set noati command from Eclipse vrapper.
HTH.
Here are two things that might help you.
1) Stay out of insert mode.
The way undo works is in terms of vim commands. So if you change to insert mode and type a hundred words, that counts as a single command. On the other hand, if you press escape every once in a while to get out of insert mode, undo will behave much more pleasantly.
Once you get more familiar with vim, you will want to do less and less in a single insert. So the undo problem will likely be reduced as well.
2) Temporarily disable vrapper via the toolbar icon.
This is an alternative if you absolutely need the default undo behaviour of Eclipse.

Emacs shortcuts for IDEA IDE?

I'm just switching from Emacs to IDEA and it would be a great help to me if I could use shortcuts like Ctrl-A for jump-to-line-start. etc.
Is this possible?
Go to Settings -> IDE Settings -> Keymap and you will have all the keymappsing.
One of the Keymaps you can select from is Emacs.
A note from a long time Emacs and IDEA user - Emacs bindings in IDEA are simply mission impossible. Arthur is perfectly correct about how to enable them, but they will seriously tamper with your IDEA workflow since they tend to override a lot of default IDEA keybindings and in the end you have to come up with completely custom keymap. This is not a problem the first time - but when you have to work on some coworkers machines, or on other computers it becomes extremely annoying. I used to hold my keymap in Subversion.
So basically don't use the default Emacs keybinding in IDEA - copy the basic setup and extend it personally. The IDEA server might be helpful to keep several computers in sync with the same keybindings.
Also keep in mind that only basic navigational commands are supported in IDEA and some helpful IDEA actions may wind up without keybindings by default so pay extra attention how you configure your IDEA.
For me there is only like place like Emacs - and that's Emacs. I have yet to see some software that provides sensible settings using Emacs keybindings.
There's a useful article on this topic here.
The gist of what it says is
You can tweak keybindings, but it's a bandaid at best, lost cause really
You can do better by LivePlugin Scripting with Groovy
You can create an escape hatch to emacs using emacsclient

How to Make Eclipse More Like Emacs

I am very familiar with emacs--and I realize that there is nothing that it cannot do--but there are some things that it does not do well or efficiently. So, being between projects I am open to the idea of switching to a full-featured IDE such as Eclipse.
With muscle-memory being what it is, I would like to make Eclipse as emacs-like as possible. I have already discovered the excellent Emacs+ plugin which gets me about halfway there. However, I am still missing the following features of emacs which I routinely rely upon:
shell: It's not just a shell, it's also a buffer.
occur: Search->File... is close to what I want, but I just want it to search the current file--which might be a text file, a logfile, or a shell buffer, or whatever.
align-regexp: This awesome little command in emacs helps me make files more readable, and alignment helps with keyboard macros.
What plugins would you recommend to solve these issues? Are there any other emacs features you miss in Eclipse or plugins you would recommend?
Please, no emacs/vi zealots asking why on Earth I would do such a thing.
For the shell you have WickedShell
Ctrl+F is enough to trigger a Search within the current file. (does not create a new buffer with matched lines)
Only Mark Occurrences is about highlighting occurrences, but that is not as advanced as the Emacs function.
Formatter options can emulate "align-regex" function, as described here.
Preferences -> Java -> Code Style -> Formatter.
Click 'Edit' on the profile (you may need to make a new one since you can't edit the default).
In the indentation section select 'Align fields with columns'.
Then, in your code Ctrl+Shift+F will run that formatter.
I can confirm Brian's suggestion (Emacs key-bindings). What I do to resolve this dilemma is to use both Emacs and Eclipse simultaneously. They are both very good at reporting external changes to files so there is minimal chance of tromping on edits (but it can happen). More to the point, you can leverage the strengths of both tools without having to give up either one. The combination of using both tools and Eclipse having Emacs key-bindings makes this quite satisfactory for me.
IIRC (It's been a while since I've used eclipse) eclipse has a "use Emacs key-bindings" mode. I believe that there's also the option to tell eclipse to use emacs as its own editor...

Painless integration of Eclipse with Vim?

Has anyone managed to get Vim integrated into Eclipse painlessly? I just want to use Vim for the editor while retaining the general Eclipse interface. I have tried using Eclim plugin but the editor seemed to crash more often than work (the site said that the editor replacement functionality is still beta).
On the flip side, is there any IDE which matches Eclipse's functionality—mainly the integration with SVN, ant, etc.—and is also able to use Vim?
I mostly use eclipse for SAS SCL, Java and Javascript programming and find the eclipse editor too "mouse-y".
I'd also like, in a perfect world, to use vimdiff as a diff viewer for SVN (we use TortoiseSVN) while checking for diffs or conflicts during merge etc. I admit I havent spent a lot of time trying to get these things to work. I feel guilty about spending too much time on potential wild-goose-chases while my other team members are working away at their code, perfectly content with all that Eclipse has to offer.
Edit: Just found this while desperately browsing around: Vim plugin. Any experience using this? From the claims on the site, it sounds perfect.
I've been using Vrapper for about 2 months and it works great. It is simple to install, and makes life much easier.
It doesn't integrate Vim with Eclipse, it just emulates Vim's behaviour so you don't need to have Vim installed.
EDIT:
I have been experiencing errors while refactoring methods in Eclipse (only when Vrapper was installed) so I stopped using it.
Now I'm using ViPlugin (very similar to vrapper). It works great (especially since version 2.0) and I recommend it, but it is not free (but cheap and has a trial version)
Edit
As the new post mentioned, if we always use the rename dialog to rename, it can be a work around for Varpper.
Preferences > Java > and uncheck "Rename in editor without dialog"
http://sourceforge.net/apps/trac/vrapper/ticket/96
The consensus seems summarized in that Wanted: VIM in Eclipse article.
No decent Vi plugin exists for eclipse, except viplugin which does not offer macro mechanisms.
Whereas on the NetBeans side... jvi does a killing job ;)
WOW, this is the one!
http://vrapper.sourceforge.net/home/
It just came out a few months ago, and seems much better than the other alternatives...and it is open source.
I use Viable, which is a new plugin for Eclipse providing Vi emulation. It is very similar to vrapper, but it doesn't have the same problem as vrapper with refactoring (as cysiek10 described.)
It's got some pretty cool features which none of the other Vim emulators in Eclipse seem to have (though jvi for NetBeans has a few of these) such as:
Visual block mode
External filters and commands
Command history
Window splits (love having this one!)
It is pay; however, you can try the full version for free just like viPlugin.
I never had much luck with vim integration into any IDE, be it Eclipse, Visual Studio, NetBeans, or sth else. Instead when stuck using an IDE, I just make the IDE launch a custom program: which passes the file onto vim using the client/server feature.
I.e. vim --servername SomeName --remote-{choice of how to open it: splits or tabs} {extra args like filename and +line#}
I just tried Eclim http://eclim.org/ and found it really good. I can still edit inside Vim, and enjoy most of the benefits of the eclipse IDE inside Vim (such as better omni completions).
The best thing about Eclim is we are still using the original Vim, so I can enjoy all the existing benefits (my own functions, macros, etc.) while having the extra convenience provided by an IDE.
http://vimplugin.org, which I found over the weekend was the closest I could come to a nice integration. Unfortunately when I opened more than 2 files in my IDE, it made my entire workstation unresponsive. And I didn't even use the "new process" option for the editor.
So bottom line it does seem that there is no decent integration available yet. Although with some it's close. I'm rooting for vimplugin to stabilize and I'll also some time (when I'm not eating up my employer's time like now) play some more with hte plugin to see if I can make it usable.
I tried Eclim and didn't like it at all. I ended using this plugin called "viPlugin," which actually works well enough to warrant using it every day. Here is the site for viPlugin:
http://www.viplugin.com
The big downside of this plugin is that it's not free. I paid for it, and I think it's worth it.
...is there any IDE which matches Eclipse's functionality -- mainly the integration with SVN, ant, etc. -- and is also able to use Vim?
IntelliJ IDEA has a very good VI plugin, but I didn't like it, although the plugin did it's work.
My problem was I have formed habits to use IDEA and those were harder and my experiment didn't it through. So I uninstall the plugin, and learned idea shortcuts instead.
But, is not free :(
Vrapper does the trick.
After installing Vrapper you need to remove CTRL+W key binding in Eclipse settings. Or else it keeps closing the editor when you actually meant Backspace.
It also comes with "surround" and split window plugins. Be sure to install those.
This is not 100% Vim, though. And nothing is 100% Vim except for Vim (doh!). You will find some commands missing (or you may not, depending on how "vimy" you are). But vrapper has :vim command, which opens up Vim editor with the current file in the buffer and places your cursor in the exact location in the file. This way you can continue editing from where you left off. When you're done in Vim just close the editor, and you return to your eclipse editor.
I hope this was helpful.

vim commands in Eclipse

I have been doing some java development lately and have started using Eclipse. For the most part, I think it is great, but being a C/C++ guy used to doing all of his editing in vim, I find myself needlessly hitting the Esc key over and over.
It would be really nice if I got all the nice features of Eclipse, but still could do basic editing the same way I can in vim. Anyone know of any Eclipse pluggins that would help with this?
Vrapper:
an Eclipse plugin which acts as a wrapper for Eclipse text editors to provide a Vim-like input scheme for moving around and editing text.
Unlike other plugins which embed Vim in Eclipse, Vrapper imitates the behaviour of Vim while still using whatever editor you have opened in the workbench. The goal is to have the comfort and ease which comes with the different modes, complex commands and count/operator/motion combinations which are the key features behind editing with Vim, while preserving the powerful features of the different Eclipse text editors, like code generation and refactoring...
There is this plugin that costs $20+
http://satokar.com/viplugin/
I use it and it works great, you've got basic vi movement commands and a set of others.
Here is an open source, free plugin but i've never been able to get it working (i'm on a mac).
http://sourceforge.net/projects/vimplugin/
You can also go the other way and get eclipse code completion inside vim.
http://eclim.sourceforge.net/
You basically run an instance of Eclipse and you will be working inside vim. They just released a version compatible with Eclipse 3.4.
New plugin I've started using
https://marketplace.eclipse.org/content/viable-vim-eclipse
Viable has pretty much what you are looking for along with some extra features which none of the other plugins for eclipse seem to have, like some support for visual block mode, command line history, window splitting, and piping external commands.
It is pay ($15.00 CAD) but free to tree with all the features. I personally like it better than the other solutions.