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.
Related
Netbeans has a nifty shortcut completion, I use while I type. It works in comments, in strings. Pretty much places where regular completion is useless. It basically autocompletes using the editor scope (in other words, whatever word matches closes to the point you are typing). Is there something similar in Eclipse ? I am making a transition due to lack of mybatis/mylyn support in netbeans. You can read more about it here https://blogs.oracle.com/chengfang/entry/why_am_i_using_netbeans .
It's called Word Completion. The key binding may vary; Ctrl/Cmd+Shift+L to find out.
CTRL+Space will show and sometimes autocomplete (depends on the settings you choose) methods names, variables and etc.
You can read more about specific settings and further fine tuning here.
eclipse is good at autocompletion when static typing , when is dynamic typing ,eclipse failed to autocompletion ; in sublime ctrl+p ,type # and type 'method name'to find function/method list , It is a wonderful way to find the right method while coding dynamic typing language ;
the key point is :
the operation in sublime text 2 is very convenient ,all key type is in one input box ; never need to chage active file tab; we can focus on the active code file tab ;
is there any plugin in eclipse or vim which can search method of any file conveniently ?
In ST2, this feature is used to quickly jump to a method anywhere in your project.
In Eclipse, Control+Shift+R can be used to jump quickly to a "resource" (file) and Control+Shift+T is for jumping to a type (not method). Control+o opens a very useful and quick outline of the current file. It doesn't work project-wide.
I'm not aware of something that works exactly like ST2's feature. Did you search the marketplace?
In Vim, FuzzyFinder, Command-T and CtrlP all allow you to navigate through your project using fuzzy matching. They can be setup to use your tags file. AFAIK, there's no plugin that provides exactly what ST2 provides.
From your question I'm not sure you use it as intended: it sounds like you use it to show a list of methods in some file in your project in order to use the right method in your code. This sounds a lot like you'd benefit from autocompletion to me.
Being an IDE, Eclipse shines on that front: its "code assist" window will show you where the suggestion is defined as well as its type.
Vim's "omnicompletion" is quite limited compared to an IDE but, depending on your language and using some third party scripts, it can be made quite powerful.
In visual studio it 's easier to push F12 button to jump to a declaration of a function or variable when editing C/C++ code.
Is there a short-cut key in emacs to do that?
Well, it's a bit more involved than that.
By default, Emacs doesn't "know" about function declarations for C or C++ code. First, obtain Exuberant Ctags. Then, use command etags (ctags for Emacs) on your source code. A file named TAGS will be generated.
Then, while editing your source code, when you want to jump to a declaration, press M-. (meta and dot, or alt and dot on modern keyboards). At first, Emacs will ask you for location of your tags file. Point it to the one you generated and afterwards navigation will be automatic.
I'd suggest reading Emacswiki article about tags for a better understanding of this functionality.
The newest version of Emacs (23.2) comes with CEDET integrated, which has more advanced features for C and C++ navigation, but it can be a bit difficult to set up right, so read more about it if you're interested.
M-. key will take you to the function definition emacs.
As others have said there is no built-in universal solution for this in emacs. That said, after having this functionality in IntelliJ I wanted it in emacs too so I made Dumb Jump.
Right now Dumb Jump has basic support for:
JavaScript
Emacs Lisp
Python
Go
PHP
Ruby
Faust
and more... (over 20 now)
It's available via MELPA and is actively being developed.
There are multiple ways to do this. As darioo mentioned, Ctags is one, but it goes to the definition by default (which might work for you). Looking further, though, you can see that prefixing M-.(ie, C-u M-.) will take you to the next tag match (which is often the declaration). There is also a --declarations option, but Exuberant Ctags doesn't seem to support it.
CEDET is another option, but in my experience, it's still not ready for production. Often times in C++ semantic-ia-fast-jump will go to forward declarations instead of the definition or the declaration.
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.
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...