My coworker keeps insisting that I make the switch from IntelliJ to Eclipse. I'm considering relenting, mainly because the compile/deploy time it takes for my Android project seems to be considerably less in Eclipse than IntelliJ (I imagine Eclipse does some sort of incremental compilation, etc. that IntelliJ can't do for Android).
However, there are a few shortcuts that I feel are essential and I don't want to do without, and I'm wondering if anyone knows of a way to do them in Eclipse (perhaps add via a plugin?):
Ctrl-W (select word, and then expands selection to include statement,
block, method, class... this should work in XML and other types of code as well)
Ctrl-D (duplicate selection, if selection, or otherwise line)
Ctrl-Shift-V, paste from history (pops up a list of recently copied text)
Go to Symbol (searches through all methods, fields, etc in your project)
I'm sure there are a bunch of others I'll really miss, but these are the main ones I use all the time.
about the go to symbol thing
there are the following functionalities available
ctrl + shift + r - open resource
ctrl + shift + t - open type
ctrl + alt + g - find the selected text in workspace
ctrl + shift + g - find references in workplace (as selected by caret)
ctrl + o - quick outline, all methods in class
there is also a plugin calld instaSearch that you can easily install, it offers a complete project active search.
I believe IntelliJ is a much better IDEA, but you asked..
ctrl+w
Alt Shift Up Expand selection to enclosing element
ctrl+d
Ctrl Alt Arrow Duplicate line(s) up or down
ctrl+shift+v
Not that I have seen
ctrl+shift+a
No, and that is a truly amazing feature.
Related
Anyone know of a set of hotkeys that can perform a find/replace in eclipse?
Currently the flow looks like:
Select line or lines
Ctrl+F
Type phrase
TAB
Type replacement
And then I have to do the unthinkable and grab my mouse, choose selected lines and then click on replace. It doesn't sound like much, but it seriously disrupts my flow when i'm doing a bunch of word replacement. I wish their was a way to choose "selected lines only" and "replace all" using keystrokes only besides having to hit TAB 12 times. Or maybe i'm using the wrong tool within eclipse for this sort of thing...
Using Ubuntu and Eclipse Luna 4.4.2
Using Find/Replace for refactoring seems like a smell. You should instead use the refactoring operations
Rename : Alt + Shift + R
Extract constant : Alt + Shift + K
Extract method : Alt + Shift + M
Extract variable: Alt + Shift + L
Inline : Alt + Shift + I
Change method signature : Alt + Shift +C
Introduce indirection
Introduce parameter object
and so on, which all do a kind of replacement by themself, but always work on the syntax tree and not on the text. However, the refactoring support depends much on the language used in the project, and while Java has really good support in Eclipse, this might not be the case for other languages.
I had been trying for this for a long time and ended up in multiple pages without help. I figured it out myself after playing around
For the first time, you need to do the below
Ctrl + F - to open the search box on the top right corner of the IDE (as in image)
You might have to drill down (using the small icon on the left of the search box) to see the replace text
This setup stays from now onwards.
Now you can simply use
Ctrl + F, Tab, Alt+Shift+Enter combinations to do the search and replace
I use eclipse 2020-03 on windows. I am pretty sure many of the previous releases had the same functionality on linux as well.
Screenshot of the feature:
I found thath ctrl+K works in my ide (Neon.3 Release (4.6.3) on windows)
First use Ctrl+f to set a term for search, then use ctrl+K to move to next.
If you need to replace something, keep in the clipboard the text and use ctrl+K, ctrl+v.
Is there an equivalent of Ctrl + Shift + L (show shortcut references) from Eclipse in IntelliJ IDEA?
I am switching to it from Eclipse but I have to check the keymaps frequently and I would like to have access to the quick reference of shortcuts instead of opening the settings to do it.
Learning shortcuts: I switched from Eclipse, too. Initially I started with the Eclipse key bindings, but then decided to switch completely. I used KeyPromoter for about 2 days, it is annoying but increases the learning curve heavily. Help->Find Action... (Ctrl+Shift+A) helps, too.
Reference card: After that I printed my own shortcut reference. Took one hour, but it was worth the time, because I have adapted some shortcuts and some shortcuts are displayed incorrectly in IntelliJ Idea. Here's a Word template.
Command + Shift + A displays a field that performs a search on an action or option name. Shortcuts along with their corresponding keymap are displayed during the search.
I think Ctrl + Shift + L (show shortcut references) from Eclipse must do "Introduce variable..." In Idea it is Alt + Shift + V or with menu Refactor/Introduce variable...
May be useful to somebody(begginers like me :) ).
The correct answer is Ctrl+Shift+F to search text everywhere in the project.
I usually use "Shift Shift" that it searc everywhere shorcuts included.
So for example if I need to search "Optimize import" I do
Shift Shift and write "import" or "optimize" and it appear.
Is there something like the Emacs backward-paragraph and forward-paragraph functions available in Eclipse ?
I searched in the Eclipse keys preference pane but could not find anything related to paragraph.
I know that Eclipse has more sophisticated navigation methods but I would like to make Eclipse behave (regarding key bindings) as much like Emacs as possible.
As far as I know Eclipse does not have that functionality.
CTRL + L + (line number) — is the closest shortcut to what you want, that I can remember.
CTRL + SHIFT + (ARROW DOWN|ARROW UP) — will move you to the previous/next method
CTRL + Q — will take you to the last place edited.
It’s been a while since I used Eclipse, but I believe those are all still valid commands.
I was trying to learn all the eclipse shortcuts... I couldn't find anything useful.
There are some shortcuts available for easy ones, like Find, Find in Files, Comment, Uncomment etc.
Is there any way to view all the eclipse shortcuts?
Clicking Ctrl+Shift+L from eclipse, will list all the shortcuts. This is pretty useful, as you don't need to switch to another window... You can do your work without any interruption.. :-)
Open Windows->Preferences->General->Keys. Now you can use the filter to find your shortcut and change its binding.
CTRL + SHIFT + L
Shows you a list of your currently defined shortcut keys.
However this will only show you custom short cuts that user have added therefore, Please find useful eclipse short-cuts below
CTRL + /
In line Comment
CTRL + SHIFT + /
Block Comment
CTRL + D
Delete row. Try it! You no longer need to grab the mouse and select the line, or select Home, Shift + End, Delete. Quick and clean.
ALT + Up/Down Arrow
Move the row (or the entire selection) up or down. Very useful when rearranging code. You can even select more rows and move them all at once. Notice, that it will be always correctly indented.
ALT + Left/Right Arrow
Move to the last location you edited. Imagine you just created a class "Foo", and now you are working on a class "Boo". Now, if you need to look at the "Foo" class, just press Alt+Left Arrow. Alt+Right Arrow brings you back to "Boo".
CTRL+SHIFT+O
Organize imports. What happens when you first use a class you have not yet imported? You will see an error. But when you press this magical combination, all your missing classes will be imported, and the unused imports will vanish.
CTRL+1
Probably the most useful one. It activates the quick fix. Imagine you create a class, which implements some interface. You will get an error, because the inherited methods are not yet implemented. While you are on line where the error occurs, press this combination to activate the quick fix. Now, select the "Add unimplemented methods" option. You can use the quick fix at every error you ever receive.
Quick fix comes in handy in other situations too. My favorite is the "Split variable declaration". Sometimes I need to broaden the scope of a variable. I activate the quick fix, split declaration, and use alt + arrow to put it where it belongs. You can find even more uses: Convert local variable to field, rename in file, inline local variable, etc...
You could use the "Split variable declaration" on the bar variable, and then move it with Alt+Arrows above the try block..
Or you could use the "Add unimplemented methods" fix here.
The best thing you can do if you see an error is to use the quick fix.
CTRL+SHIFT+T
Open Type. Imagine, that you need to have a look at the "Foo" class. But, where is the "Foo" class? Is it in the "Boo" project and in the "foo.bar" package? Or somewhere else? With this shortcut, you don't need to know. Just press it, type "Foo" and you are in.
CTRL+E
Shows you a list of all open editors.
CTRL+F6
Use to move between open editors. This is a slower alternative to Ctrl + E. It comes in handy in a situation when you want to periodically switch between two editors, something that is nearly impossible with Ctrl+E as it sorts entries quite randomly. Or you might just use Alt+Arrows...
CTRL+F7
Move between views. When in the editor, press Ctrl+F7 to switch to the Package Explorer, or hold Ctrl and press F7 multiple times to switch to other views.
CTRL+F8
Move between perspectives. The same as the previous.
CTRL + F11
Runs the application. What gets launched depends on your settings. It will either launch the last launched class (my preferred way) or it will launch the currently selected resource (the default way). If you want to change its behavior read the previous post.
CTL + N
Open new type wizard. This is not very quick because you have to select the wizard type (whether you want to create new class, jsp, xml or something else) in the next step. A much faster way would be if you could just hit the shortcut and invoke the particular wizard. It is possible, just keep reading...
CTRL + M
Maximize or umaximize current tab.
CTRL + I
Corrects indentation.
CTRL + SHIFT + F
Formats code. You can make beautiful looking code out of a mess with this. It requires a bit of setup, but it is well worth it. You can find its settings under Window->Preferences->Java->Code style->Formatter
CTRL + J
Incremental search. Similar to the search in firefox, it shows you results as you type. Don't be surprised if when you hit this combination nothing happens - at the first glance. Just start typing and eclipse will move your cursor to the first occurence.
CTRL+SHIFT+G
Bind this to "Generate getters and setters". This is a "must have".
ALT+C
Bind this to SVN/CVS "Commit".
ALT+U
Bind this to SVN/CVS "Update".
yes, you can go Window - Preferencee - General - Keys and see all available shortcuts. Also you can reorder keys here.
Also you can read more about eclipse shortcuts here
Does Eclipse have a way to search a whole project for some text like Xcode's "find in project" feature?
1. Ctrl + H
2. Choose File Search for plain text search in workspace/selected projects
For specific expression searches, choose the relevant tab (such as Java Search which allows you to search for specific identifiers)
For whole project search:
3. Scope (in the form section) > Enclosing project (Radio button selection).
Ctrl + Alt + G can be used to find selected text across a workspace in eclipse.
OSX: ⌥ Option + ⌘ Command + G
Press Ctrl + H to bring up the search that includes options to search via project, directory, etc.
Ctrl+H.
Also,
Open any file quickly without browsing for it in the Package
Explorer: Ctrl + Shift + R.
Open a type (e.g.: a class, an interface) without clicking through
interminable list of packages: Ctrl + Shift + T.
Go directly to a member (method, variable) of a huge class file,
especially when a lot of methods are named similarly: Ctrl + O
Go to line number N in the source file: Ctrl + L, enter line number.
Ctrl + H is the best way!
Remember to copy the string before you start searching!
You should check out the new Eclipse 2019-09 4.13 Quick Search feature
The new Quick Search dialog provides a convenient, simple and fast way to run a textual search across your workspace and jump to matches in your code.
The dialog provides a quick overview showing matching lines of text at a glance.
It updates as quickly as you can type and allows for quick navigation using only the keyboard.
A typical workflow starts by pressing the keyboard shortcut Ctrl+Alt+Shift+L
(or Cmd+Alt+Shift+L on Mac).
Typing a few letters updates the search result as you type.
Use Up-Down arrow keys to select a match, then hit Enter to open it in an editor.
CTRL + H is actually the right answer, but the scope in which it was pressed is actually pretty important.
When you have last clicked on file you're working on, you'll get a different search window - Java Search:
Whereas when you select directory on Package Explorer and then press Ctrl + H (or choose Search -> File.. from main menu), you get the desired window - File Search:
yes, but you need to open the global search panel. to do so, press the binoculars icon on the top right corner of the IDE.
you can even filter searches by function identifiers, method scopes an etc...
Choose File Search for plain text search in workspace/selected projects
For specific expression searches, choose the relevant tab (such as Java Search which allows to search for specific identifiers)
First customize your search dialog. Ctrl+H. Click on the Customize button and select inly File Search while deselecting all the others. Close the dialog.
Now you can search by selecting the word and hitting the Ctrl+H and then Enter.
yes, but you need to open the global search panel.
to do so, press the binoculars icon on the top right corner of the IDE.
you can even filter searches by function identifiers, method scopes an etc...
There is no way to do pure text search in whole work workspace/project via a shortcut that I know of (and it is a PITA), but this will find references in the workspace:
Put your cursor on what you want to lookup
Press Ctrl + Shift + g
There is very nice tool "Eclipse Quicksearch" available. Checkout SpringSource Update Site for Eclipse i.e: http://dist.springsource.com/release/TOOLS/update/e4.6/ (you can try other versions replacing last part of URL with i.e. e4.4 or e4.5)
It works well with Neon Release (4.6.0). It gives you nice incremental text search with source file preview. I had no issues with it so far.
Usage:
Alt + s "Quick Search Command" opens "Quick Text Search" dialog. You can select whether search should be case sensitive or not. Really good tool.
Ctrl+H is very handy here. I mostly search in the current project, not the whole workspace. To find all occurences in the whole project of a string that is in your current buffer, just select the string press Ctrl+H and hit enter. Easy as that!
Use Resource Filters!
Eclipse will restrict the search result using the Resource Filters defined for your project (eg. right click on you project name and select Properties -> Resource -> Resource Filters). So if you keep getting search hits from parts of your project that your not interested in you could make Eclipse skip those by adding a Resource Filter for them. This is especially useful if you have build files or logs or other temporary files that are part of your projects directory structure, but you only want to search amongst the source code. You should also be aware of that files/directories matched for exclusion in the Resource Filters will not show up in the Package Explorer either, so you might not always want this.
Search and Replace'
Ctrl + F Open find and replace dialog
Ctrl + F / Ctrl + Shift + K Find previous / find next occurrence of search term (close find window first).
Ctrl + H Search Workspace (Java Search, Task Search, and File Search).
Ctrl + J / Ctrl+Shift +J Incremental search forward / backwards.
Type search term after pressing Ctrl+J, there is now search window
Ctrl+shift+O Open a resource search dialog to find any class
What others have forgotten is Ctrl+Shift+L for easy text search. It searches everywhere and it is fast and efficient. This might be a Sprint tool suit which is an extension of eclipse (and it might be available in newer versions)