How to Make Eclipse More Like Emacs - eclipse

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...

Related

VSCode-like integrated terminal functionality in nvim? (eg: open files mentioned in terminal output in a buffer)

I'm coming from VSCode to Neovim, and for the most part I've been able to accommodate/replicate the workflows and functionality I've gotten used to in VSCode in Vim. Right now, I'm stuck on replicating the Link functionality of the VSCode integrated terminal.
This lets you mouse over text like main.py or server.go:50 and ctrl-click to jump to that file or line location in your editor panes. This really helpful for jumping to the locations of compilation errors or test failures from their associated terminal output.
I've searched for existing plugins/solutions for this but haven't found any. Are there any that I've missed? Otherwise, what might be a good approach to scripting this myself?
I'm new to vimscripting, but I'd assume you could do some regex and with knowledge of the current working directory, you could infer the correct filepath to open.
Replicating one editor's workflow in another is not exactly a good idea as the two editors have—supposedly, if not why switch in the first place?—different feature sets or even paradigms. For instance, staying in insert mode all the time in Vim because that's what you are used to would make no sense because Vim derives most of its value from its modality… and you would probably also find examples in the other direction.
Case in point, compiling and jumping to errors in Vim typically doesn't involve the built-in :terminal at all. You are supposed to use the :help quickfix feature, which exists for that very purpose.
See :help 30.1 for a gentle introduction from the user manual.

Macro functionality with keyboard shortcuts in Eclipse?

Having used Netbeans for ages and being new to Eclipse I couldn't see any built-in Macro functionality in Eclipse. I found the Practically Macro plug-in but this does not seem to have the capability to add keyboard shorcuts. One needs to go through two menus and therefore two mouse clicks to run a macro using the aforementioned plugin.
This does not serve well for my need of frequent macro applications. Is there anyway to have very simple Macros using keyboard shortcuts in Eclipse? Or should I start writing my own Eclipse plugin for this? Or perhaps use another light weight tool for this purpose? Do you have any suggestions?
There doesn't seem to be anything else than Practically Macro for Eclipse. Once you use a Macro, you can press Ctrl-Alt-P to replay that. This helps a bit, but when you want to switch between a couple of macros back and forth doesn't help much.
Not sure about this Macro plug-in you're using, but you can modify keyboard shortcuts (Helios) in Preferences->General->Keys.
Testing PracticallyMacro I found that it did not record right clicks but I was able to find a perfect utility 'TinyTask' and 'TyperTask'. The former can export record and save as small 'exe' files which can then be added as external Eclipse builders the latter can automate tasks based on typed characters - epic.

Activating text editing macros on Netbeans

This question was asked on Super User but I didn't get any response so I moved it here...I believe it is relevant and important...
I've been using Netbeans on Mac OS X for sometime it has some really good features but it doesn't support most of the macros and that sucks. I'm not only talking about complicated emacs macros but even the most basic are not supported like C-e for the end of the line or C-a for the beginning of the line.
Can somebody help to activate macros ?
I'm not sure if you really mean macros. When I think of macros, I think of a series of commands and keystrokes being issued. In any case, single commands (shortcuts) like the ones you mention (end of a line and beginning of a line) are certainly supported by Netbeans by default with the home and end keys. You can replace those with the key combinations of your choice or add them as alternates.
In fact, Netbeans allows you to create entire profiles of shortcuts and ships with one for Emacs users and contains the exact shortcuts you mention. This functionality is accessed from the Tools > Options menu, Keymap tab.
If you are looking for actual macro capability, that is supported in Netbeans as well. You might have to do some digging for documentation and Netbeans only comes with 3 build in macros. You can define them directly or have Netbeans record your activities to a macro. Macros can be accessed from Tools > Options menu, Editor > macros tab.
Netbeans supports templates as well, which are pieces of predefined code or text that can be generated by entering an abbreviation in the editor and then hitting tab.

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.