In a Visual Studio, you would use Ctrl+L, whereas in Eclipse I am forced to select a line or, if it is empty, go the beginning of the line before clicking delete/backspace.
Is there a quick shortcut? Thanks!
Ctrl + D
From Help->Key Assist... there are all kinds of useful keyboard shortcuts for Eclipse.
For Mac users: ⌘ + D
In the future, if you need to quickly find a keyboard shortcut for something simple, just hit Ctrl+Shift+L.
Ctrl + D should delete the line.
You can reassign the Delete Line command to your favourite hotkey.
Window->Preferences
General->Keys.
Now type "Delete" and reassign the filtered command.
if your are using MAC then it is
command + D => ⌘ + D
To quickly find shortcuts, hit Ctrl + L, Ctrl + L (Ctrl+L twice), then type something approximating what your command does in the filter text for the key assignments. This works pretty well for most shortcuts, although it can be a bit tricky for some where the name of their menu assignment bears no relation to that of their command in this list (for instance, Team->Revert to base appears in the keys list as 'Replace with latest from repository'), so sometimes a little lateral thought is required :-) If no shortcut exists, it's easy to add one in the keys dialog.
And if you want it as a list to take a print or something, here is a link to the eclipse shortcut pdf.
shortcut to pdf page
press Ctrl+Shift+L TWICE and press TAB then you can type to find your shortkeys
Related
currently in eclipse if i want to generate a constructor or getters/setters i
go the class name right click on that ->source->access the right Generation option
while in the android studio we have a convenient and fast shortcut to do that
i just need to press CMD+N anywhere in the page to open the generate dialog
is there an eclipse shortcut available that is equivalent to that ?
Press Alt+s then type c for constructor, r for set/get s for
toStringetc..
You can go to Windows -> Preferences -> General -> Keys to map this action to a shortcut of choice.
This is how to do it:
There isn't one by default, but if you wish you can modify the mappings and add a shortcut. You can do this by going to window->preferences->general->keys
Go in window -> preferences -> general -> keys
Type generate in the search bar.
Find Generate Getters and Setters
Click on the binding field and hit your custom shortcut (here : Ctrl + Alt + Shift + S).
Go to Windows -> Preferences -> General -> Keys or you can take the list of shortcut in this site 25 Eclipse Shortcut Keys
You can also use the quick fix : Ctrl + 1.
When you have an error, it allows you to resolve this error. and when the cursor is on a variable, it allows you to generate getter and setter.
If you want an empty construtor, just type Ctrl + space somewhere in your class.
Short answer: no.
But google shows a number of pages on how to do it, e.g. https://wiki.eclipse.org/FAQ_How_do_I_provide_a_keyboard_shortcut_for_my_action%3F
A lateral solution, but you may be interested to check out Project Lombok (I don't use it myself at the moment.)
As I remember ,alt + insert do this.
The answer by #Rustam put me on the right path.
but since his answer is based on windows version of eclipse and I am using mac i was unable to confirm it .
i added this answer to provide additional data for any one using the MAC version of eclipse
ALT + CMD + S will bring the source menu after that you can select the correct generation option
In Intellij IDEA, how to search a string or a keyword in all project files as we can do in Eclipse by Ctrl+H command?
To search in workspace you can use Ctrl+F.
To find in path Ctrl+Shift+F is useful
Ctrl + Shift + F to search across the project
Ctrl + H = "Type Hierarchy" view = shows a tree of parent and
child classes of this class.
Ctrl + Shift + A = "It does a search as you type through all the commands
in intellij. Not only that but when you find the command you want it also
displays the corresponding shortcut key next to it!"
https://www.jetbrains.com/idea/help/keyboard-shortcuts-you-cannot-miss.html
Hope this will helpful to you !
For navigating to a class by name (Ctrl+N)
The Shortcut you are searching for is Ctrl+Shift+H
In the Find In Path dialog box displayed, specify the following options:
The text to find.
Type the text explicitly, or specify a pattern using a regular expression, or select a previously used piece of text or a pattern from the recent history drop-down list.
If you specify the search pattern through a regular expression, use the $n format in back references (to refer to a previously found and saved pattern).
Search scope (project , module or directory).
Search options (case sensitivity, whole words, and regular
expressions).
Then Click Find.
Hope this is helpful.
Ctrl+Alt+I or Ctrl+Alt+L in IntelliJ IDEA
Ctrl+Shift+F in Eclipse
You can try the above solutions and also the link which is mentioned in here for more useful shortcuts with intellij
Ctrl + Shift + N
https://www.catalysts.cc/en/wissenswertes/intellij-idea-and-eclipse-shortcuts/
Hope this helps
Thanks
I used to work at some place that could select a line of code, and by pressing "ALT + SHIFT + DOWN_KEY/UP_KEY", it would copy this line below or above respectively.
Now I work at some place else and this shortcut command does not work.
How can I enable it?
Are you sure it is ALT + SHIFT + UP/DOWN and not CTRL + ALT + UP/DOWN?
If I correctly understand your request, then what you need is to open the preference and go to General > Keys. Look for Copy Lines and Duplicate Lines.
You can use CTRL+ SHIFT+L to see a list of short cuts to check you remembering correctly.
Otherise you can customise/enble shortcuts using
Window --> Preferences --> General --> Keys
As I use Linux, I found the problem.
It has a shortcut registered. What you have to do is disable it.
Go to System, ShortCut Keys, then you remove the shortcut "CTRL+ALT+UP" and "CTRL+ALT+DOWN".
Done, it works.
Is there a way to comment/uncomment a block of selected text in IDEA?
Yes, highlight the block and type Ctrl + Shift + /. To uncomment, just repeat.
with Shift this makes for block style comments /**/, without it for line style comments Ctrl + / -> \\ (tested with IDEA 10U)
Jetbrains provides a printable reference card with the default set of Windows and Mac key bindings.
For the benefit of others who might stumble across this question & answers... In addition to the windows key binding provided in other answers, there is also a keystroke for toggling a comment bock in IntelliJ IDEA on the Mac.
Line Comment
⌘+/
Block Comment
⌘+SHIFT+/
The Cmd+Shift+/ doesn't work under Mac with Spanish keyboard layout, because this shortcut it's bind to the main character on the key, which in this case is 7, not /.
For someone else having the same issue, pressing the Cmd+- (Ctrl+- in Windows) is the shorcut for single-line comment while Cmd+Shift+- works for multi-line comments.
use this Simbol
/*
write any thing
*/
For windows
Ctrl + Shift + /
For mac
Cmd+Shift+-
If the Cmd+Shift+/ doesn't work for you (often the case with spanish / german and other keyboards) and you don't want to set it to US/EN keyboard, then use:
Cmd+Alt+s to open the IntelliJ-settings -> select Keymap and search for "Comment with Line Comment" or "Comment with Block Comment". Then rightclick on it and select "add Keyboard Shortcut" and set your own shortcut, for example: Cmd+Shift+NumPad /
I am aware of the Eclipse snippet "sysout" which is neatly replaced with System.out.println(); when tab-completed.
This is very useful but sometimes, I need to wrap some existing code in a System.out.println();
In Eclipse internals, the template is defined as being able to wrap a "selected word". But how can I use the snippet with selected text since typing "sysout" obviously removes the selected text.
Any idea?
The sysout template acts upon entire Java statements.
Highlight a statement in the editor.
Hit CTRL-SPACE (or whatever you have set up for content assist.)
Type sysout then hit enter. Note that when you're typing sysout it will temporarily overwrite your statement (but it will come back wrapped by System.out.println when you hit enter.)
Eclipse has "Surround Width" Option which can do this for you.
SHIFT + ALT + Z should get you that to see how that templates meta-data layout.
I don't think you can do it in one go, but what about cutting the selected text and then: tab+space, ctrl+v
it's just one key combination more.
if you use content assist (ctrl-space on Windows), at the end of the list will be the sysout option. you might want to augment the template with quotes around the word selection so you dont need to type them in.
Preference>General>Keys.
then search "content assist" or "content" in "type filter text".
don't press Enter.
choice "content assist".
type Binding and set your own shortcuts.
such as "control+space".
The main part is into:
Java->Editor->Templates
This can accessed by:
Preferences window: into Java->Editor->Templates.
Surrounding a text and press:
Windows: SHIFT + ALT + Z (as sadhasivam said)
Mac: CMD + OPT + Z
to display the Preferences Window