When Using Pydev on Eclipse, I wanted to bind Ctrl+Shift+D Copy Lines and Ctrl+D to Delete line. But when I do so, the Ctrl+Shift+D doesn't work.
I removed all the other bindings of Ctrl+Shift+D but it doesn't work.
Fun fact, if I choose Ctrl+Shift+C, it does work, so I'm wondering where is this key binding used.
The problem arrises only in Pydev, ie. when I open the file in Text editor the bindings work.
This was fixed for PyDev 6.3.3.
The problem was that there was a command bound to Ctrl+Shift+D which was not visible there because it wasn't properly categorized.
I fixed this in: https://github.com/fabioz/Pydev/commit/422a0bde1d1a3ac5c091c00e88368a3bc3c0dc5f
Note that you could still override it if at the keybindings dialog you created a command and put the 'When' as 'PyDev editor scope' (which defines when it's active -- it wouldn't work without this because the hidden action had a higher priority given that its scope was narrower).
See details at: https://www.brainwy.com/tracker/PyDev/906
When working on C code in Eclipse (Mars, in case that matters), I type /* to begin a stream comment. If I hit [Enter] any time within this stream comment, Eclipse automatically inserts a column of single-space indented stars _* and a single-space indented close stream comment _*/. This is incredibly annoying as this is never the behavior I want after opening a stream comment. I then have to undo-undo or highlight and delete.
I've gone into C/C++ > Editor > Typing and unchecked every option in the Automatically close group-box, but these options only include "Strings", (Parentheses) and [Square Brackets], <Angle> brackets and {Braces}.
There's no /*Comments*/ option.
I've even tried modifying every code template that contains such a stream comment, to no avail.
How can I get Eclipse to stop auto-completing comments?
I've checked these similar questions and found no answer:
Annoying eclipse automatically closing quotes, Stop Eclipse from mangling my comments, eclipse disable completion of xml comment, How to stop Eclipse from auto-adding parentheses?
In Eclise debugger, the default step options are:
F5: Step into method
F6: Step over line
F7: Step out of method
Often I do have code like this:
obj.getMember().doStuff();
Or maybe even worse (please don't question the code design, just making this up):
obj.getInstance().createSomething().getMember().doStuff();
Usually I want to inspect doStuff() only, but F6 will not step over individual method calls, but it will step over the entire line. So I end up hitting F5 and F7 until I reach doStuff().
My question is: Is there any option to step over method calls (= do F5 and F7 in one shortcut)? Would be cool, if I had to tap X, X, X, F5 only to reach doStuff().
// Edit for clarification: I'm looking for a keyboard-only solution. I know there are several ways I can reach my method (e.g. breakpoints), but I'm asking for a combined shortcut for F5 + F7, so to say.
You have to select the method you want to step into and then with the right click of the mouse you will find the option Step into Selection :
Select the Step Into Selection command to step into the currently
selected statement in the active editor.
You must have program execution suspended for this command to be available.
As you can see from the image above you can just press OPTION and F5 on a mac once selected the method to step into ...
Shortcut :ALT + F5
You could also place a breakpoint into doStuff() and, when you reach obj.getInstance().createSomething().getMember().doStuff(); just resume execution (keybinding: F8:
All the intermediate frames will be executed and the debugger will pause directly in doStuff() again. This of course means that you cannot decide from run to run like you can do with aleroot's Step into Selection suggestion.
Alright, something completely different, since I think I understand the core of your question a bit better now.
There's no predefined skip-over-this-method command afaik, so you can build one yourself. This touches some advanced topics so I'll only post some pointers here:
Create an Eclipse plugin.
In that plugin, declare a command with a keybinding like Alt+F8 and implement the command's default handler
In the handler of your command, invoke the built-in commands which are bound to the Step into and Step out actions. You can find their IDs by looking into the Eclipse source or trying the Plugin-Spy feature.
Package up your plugin and start your Eclipse with it included.
This way you'll reuse the predefined functionality and automate your F5 plus F7 mashing into a single command with relatively small effort.
Coming from .NET background ...
Is there a way to either via key stroke or by automatic settings to have the "Import" statements added that are needed by the code?
Right now I have to right click each class that I am referencing and choose the add option to have the Imports added and that's slow. I'd like to do them all at once with a single key stroke
I found that SHIFT COMMAND O does the job.
In Eclipse Helios with Android extension, Ctrl+Shift+M works for this purpose.
You can see what you particular key binding is by going to Window->Preferences->General->Keys and enter "import" in the filter widget. Look for "Add import" in the search results.
If it is bound to a key sequence, you can use (or change ) that sequence. If it is not
bound, you can bind it to a key sequence.
+ SHIFT + O for mac users. Had me stuck for a bit but works.
I know there is a trick that when you type quickly code in Eclipse, you can hit some secret keys and it will auto-complete the missing parts. Who knows them?
example: I have someVeryLongVariablesWhichIWantToTypeFast and I start typing someVeryLongVa but nothing happens. Only when I type method names a yellow box appears that wants to help me.
Ctrl + Space is the autocomplete shortcut
All shortcuts you can find under Window -> Preferences -> General -> Keys
As mentioned the command is Ctrl+Space to auto complete.
You can speed it up using camelCase...so in your example:
someVeryLongVariablesWhichIWantToTypeFast
you could start typing sVL then Ctrl+Space should auto complete or list all variables that match.
CamelCase also works for specify classes, searching for classes etc.
Others I like/use:
type sysCtrl+Space to get System.out.println statement (or err)
type foreCtrl+Space after an array/list line to foreach it
Click on an argument to a method and Ctrl+1 to create a field for it and assign it, great for constructors
Ctrl+1 on any local variable to convert to field, split declaration, or inline it
if you have
object.method().method2().method3()
selecting object.method() and type Ctrl+1 to assign to a field or local variable, then you get
Object objLocal=object.method()
objLocal.method2().method3()
//Can now select objLocal.method2() and do the same again
My favourites:
Ctrl + Space - auto complete
Ctrl + 1 - show quick fix options when you are over an error / warning
Shift + Ctrl + L - list short cuts
One trick that I love in Eclipse for Java is writing backwards (meaning you write the client before the code it calls). We typically think of autocomplete to help us with methods and variables that already exist. This is okay, but even cooler is when a method/class does not exist.
Try typing this code into a method (anywhere, really):
Who who = new Who();
who.whatUpMan("hi", 32);
Now left-click on the Who at the beginning. It will give you the choice to create a class, interface, enum, etc.
Now left-click on the whatUpMan. It will prompt you to create the method with the right parameter types and everything.
These are called "Quick Fixes" in Eclipse and they give you total freedom to code from the client "backwards" to classes it utilizes. And when you've already got the method, of course, control-space and control-shift-space (to see parameters for methods) are your friends.
http://eclipse-tools.sourceforge.net/EclipseEmacsKeybindings_3_1.pdf
Some more time savers that don't seem to be mentioned:
Ctrl+3 'Quick Access' which basically let's you reach anything without clicking around too much. E.g. type 'nav' in the popup dialog, rather than Window | Show View | General | Navigator or wherever it is.
Ctrl+O 'Quick Outline': when editing Java (and some other things), pops up a lighweight dialog so that you find anything in the file by a few keystrokes
Shift+Alt+T 'Refactoring', and things below that menu - look for shortcuts there, use 'Rename', 'Move', 'Extract method', 'Change method signature' often
Alt+Up/Down move blocks of code up/down without cut/paste
Alt+Shift+Up/Down select various levels of code (expressions,statements, methods, class) easily
Ctrl+1 on the selected code offers you cool stuff eg. Extract to variable/constant/method; Split variable declaration -- see others above, or just try it on anything
Ctrl+Shift+R find any file in the workspace, similar to Ctrl+Shift+T to find types
Ctrl + Shift + O : resolve all dependances automaticall. In Java, it's a life saver as it cleans old packages and add the required one without a single line to write.
"Right click" then "refactor" : all the features are handy, but I espacially love "rename" (Ctrl + Shift + R, c.f comments) because it will apply the changes to all the project. No more tricky find / replace wit regexp to do ensure you breal nothing else :-)
"Right click" then "source" : equally useful, with a special mention to "generate getter and setter" and "implement methods"
Ctrl + D : delete a line. Kinda cool.
I kind of remember CTRL+SPACE was the shortcut for autocomplete.
Another time-saver is formatting the code automatically using Ctrl + Shift + F.
Formatter preferences http://img187.imageshack.us/img187/5866/eclipseformatter.png
General Eclipse tips
Get rid of all the crap that you'll never use
if you do web-dev ... install the database, php, pydev, modules and plugins
install svn/cvs/git plugin
use Trac
have different code enviornments for different code types, i.e. one for python-dev, c++, and so on.
wait a few weeks to months before updating
i have about 100 premade mini scripts that i use frequently.
learn to develop your own plugins, as it's easy and fun.
For some applications, the answer is to generate the code using EMF. But the EMF learning curve is significant.
I would suggest go to Eclipse -> Preferences -> General -> Editor -> Keys and to configure your own keyboard shortcuts for all common tasks so that you can have custom keybindings that are perfect for you.
Probably this might not exactly answer your question but it is very relevant to your question title.
You can define templates in Eclipse to magically type and get a bunch of code typed for you. For instance you may type something like syso or sout to get System.out.println() in your Java code.
This can be done by following Window -> Preferences -> Java -> Editor -> Templates. You can also add a Template View, which you find at Window -> Show View -> Other -> Search for Templates.
Here is an image to clarify
* Original related answer in here as well.
Hope it is helpful to someone :)