I want to search for a list of references on one method or class in IntelliJ. Is there any shortcut like Ctrl + Shift + G in Eclipse?
I would say that Ctrl+Alt+F7 is my favorite key combination for finding usages as it gives you a nice popup with good interaction.
Otherwise you can use Alt+F7 that will show you the same information in a tool window at the bottom that will stay there.
Look at the the Default Keymap Reference in the Help menu for all the built-in shortcuts:
for searching name of methods in whole project use:
Ctrl+Shift+F
for searching classes (Files)
Shift+F6
Ctrl + F7 Find usages in file that is, to find all places where a particular class, method or variable is used in the whole project in intellij IDEA
Related
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.
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
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.
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)
Suppose I know a function name, but I don't know which file it's declared in. What Eclipse keyboard shortcut can take me to the function I'm looking for?
What I'm looking for is similar to Eclipse's:
Ctrl + Shift + R
except it will search for method names instead.
Sidenote
With Visual Assist X, I can do this by using the "Find Symbol" feature, which is executed with:
Shift + Alt + S
This is an old question, but for the sake of people Googling this, Ctrl + O opens the code outline search, which is what you were looking for.
Yeah, this is an old question, but I have a better solution: what about F3?
And CTRL + O is what Windows users are looking for.
Not exactly a direct shortcut, but you need to go through the Java Search dialog:
(Ctrl+H):
(Sergei mentions in the comments that you might have to select "Declarations" in the "Limit To" section)
Not sure if this is exactly what you want, but if you Ctrl + H, that'll bring up the search dialog. The default option (for me, using the Java EE perspective) is a Java search. I can type in the method name, and then select the 'Method' radio button under the Search For block. Note that the default option (again, for me) for the 'Limit To' block was the 'References' radio button. I had to change that to 'All occurences' in order to see the method declaration, and not just callers.
Press CTRL + Left Mouse Button on the name your function. Eclipse will open the clicked file with this function automatically.
I use Momentics, so I'm not sure if this is in Eclipse or in Momentics plugin, but if it is Eclipse I think this is exactly what you need: CTRL + Shift + T.
Quick and dirty is to use Ctrl+Shift+Up/Down, which jumps between members (methods, variables) in Java.
If the method in question is on an interface, then using Quick Outline or F3 to jump to the definition will only take you to the interface definition. This isn't often what I want. Instead I hit, on my mac, Cmd + T on the method to get a Quick Type Hierarchy. From the type hierarchy you can go to the implementation of the method.
Simply hitting F3 by placing cursor on the function name will work for windows users.
simple 2 ways to function declarations:
Way 1: ( Whole workspace )
Ctrl + Left Click the function calling place.
way 2: ( within the same page )
press Ctrl + F to find dialog window and type n function_name and search.
these will redirect to function definition