Search in intellij vs eclipse - eclipse

I recently moved to intellij-idea-12 from eclipse.
In eclipse if select a text and click 'ctrl+k' or 'ctrl+shift+k', it takes me to next/previous search text within the file.
In intellij if i do select text and click 'ctrl+l' or 'ctrl+shift+l' it is not taking me to the search text.
In intellij first i have to do 'ctrl+f', then only 'ctrl+l' or 'ctrl+shift+l' are working.
Is there any setting to make it work like eclipse searching.
Note: I am not talking about changing keymap in intellij.

With the caret on the word you want to search for (or with the text highlighted), press CTRL+F3. After that, you can just press F3 to find the next occurrence and SHIFT+F3 to find the previous occurrence.
Note that I am still using version 11.1.5

By default it's ALT+J to move down and shift+ALT+J to move up.

Related

Search box in Eclipse

When I hit Ctrl+F in Eclipse, it would bring up a search-box asking for the term, etc.
That's annoying because if I'm on a small monitor, the pop-up would cover most of the text.
Does Eclipse have a search-bar at the bottom (or top) of the editor like Netbeans does?
(In Netbeans, when you hit Ctrl+F, a very small search-bar would appear at the bottom/top of the editor).
You can use Increment find for this. Press Ctrl+J.
Then observe in the status bar THAT incremental find is activated. Then you can go on typing your search term the first occurrence of word will be highlighted in editor if found else you will get <search term> is not found error(in red colour) in status bar.
Refer the image below
Note:
You can cycle through forward the next occurrences by pressing Ctrl+K and backward by pressing Ctrl+Shift+K
If the shortcut key for incremental find is NOT working then check the short cut keys for Increment Find and Reverse incremental Find commands in
Windows->Preferences->Keys section

How to navigate to the last cursor position in Eclipse if it is in the same file and was not edited?

I had used Eclipse earlier, afterwards I switched to IntelliJ for a while and now back to Eclipse. There is one thing from IntelliJ which I can't find in Eclipse: Navigating to the real last cursor position - even in the same file and even if the cursor was moved between the lines using the arrow keys on the keyboard or the mouse. IntelliJ is able to do it and I found it really useful.
For example:
I move the cursor using the keyboard's down arrow key successively on lines 10, 20, 30.
Now I am on line 30 and when I press Alt+left I would like the cursor to go to the line 20.
After pressing Alt+left again I would like the cursor to go to line 10.
After pressing Alt+right afterwards I would like the cursor to go to the line 20 again.
The following shortcuts are available in Eclipse:
Alt+left - it navigates back to the last cursor position in a different file, not to the last cursor position in the current file even if I already moved my cursor in the same file
Alt+right - it navigates forward to the next cursor position in a different file, not to the next cursor position in the current file even if I already moved my cursor in the same file
Ctrl+Q - moves the cursor to the last edit location
The latest version of Eclipse in which I tested the above-mentioned shortcuts: Eclipse Luna 4.4.0.
I found the following discussion about the same problem (lacking such functionality in Eclipse) which is quite old, but it seems that this functionality has not been implemented in Eclipse since that discussion in eclipse forum.
Does anyone of you know if this functionality will be implemented in Eclipse? Is there a plugin for Eclipse which provides such functionality of navigating back to the last cursor position?
Please note, that due to the reasons described above, I'm not satisfied with the solutions provided as an answer to this SO question 'How to navigate to the last cursor position in Eclipse?' or to the other SO question 'How to go back in Eclipse?'.
Go to Preferences / General / Keys. You'll be able to see or edit the bindings for:
Backward History: default is Alt←
Forward History: default is Alt→
You may also use those shortcuts (and see the key bindings) in the toolbar:
answered Sep 7 '12 at 8:27
Denys Séguret
There is Alt+left arrow and Alt+right arrow to navigate to previous/next cursor positions, and CtrlQ to go to the last edited position
Use bookmarks for that because there is no another way of tracking the necessary code lines. Here is the link about how to use bookmarks http://www.luisdelarosa.com/2005/02/16/eclipse-tip-use-bookmarks-to-track-important-places-in-your-code/
Screenshot of the aforementioned article's content in the link:
I use the side buttons of my mouse and it works for me
The key combination Ctrl + Q brings you back to the last locations, where editing was done.
Use Ctrl + L for an overview of shortcuts. See also Eclipse shortcuts or this Eclipse cheat sheet.
Navigate > Back (Alt+Left_Arrow) already allows to navigate back to previous cursor positions even in the same file. E.g. after you Ctrl+Click on a reference to a local variable (to go to the declaration), then Alt+Left puts the caret back to the reference.
Exlpanation source

Find in Eclipse overwrites Linux clipboard

I have this little annoyance with Eclipse under Linux.
Let's say I select some text in a terminal window, maybe an error message. Then I go to Eclipse and open Find/Replace (Ctrl+F) to search for the error in my code. But then, some text in the Find box is auto-selected, which overwrites what I had in the middle-click buffer. So I have to clear the Find box, go back to the terminal and re-select, then back to Eclipse and paste in the search box.
Is there any trick around this? Can I make Find open with an empty search box? Or should I just learn to use Ctrl+Shift+C and Ctrl+V to copy from a terminal to Eclipse?
it's a known issue...
not sure it's gonna be fixed
https://bugs.eclipse.org/bugs/show_bug.cgi?id=415939

How to set shortcut to a line of code in Eclipse IDE editor

I'm after a feature in eclipse that allows me to allocate a shortcut to a line (say line number 55) then go somewhere else in the same file and hit the shortcut then IDE shows me the line 55. I have used this feature in Delphi IDE. Using CNTL + number keys[1,2,...,0] a shortcut to line where the curser is will be created. This shortcut only has effect within the editor and each opened file would have its own shortcuts.
Is there such a feature in eclipse? Is there any plugins out there which adds this feature to eclipse?
Regards,
Ali
By default there is no shortcut defined for this task.
I use to define my shortcuts in Eclipse in "Windows/Preferences/General/Keys" type bookmark in the filter text and select the commands you want to define the shortcuts.
My current shortcuts are:
Alt+Shift+B, Alt+Shift+A: Add Bookmark;
Alt+Shift+B, Alt+Shift+V: Show View (BookMarks);
But, I agree, still is not fast as the Delphi predefined shortcuts.
Update 1:
This plugin (or its sucessor) seems to offer the option. From their site:
Add a numbered bookmark at the cursor: Alt>+[digit]. This creates a
quick bookmark with the specified number using a "single" keypress.
Only one bookmark of the given number can be present in the workspace.
Setting the same number bookmark again will clear the earlier
instance.
Goto a numbered bookmark: Alt+Shift+[digit]. Moves to the bookmark as
it was set using Alt+[digit].
Update 2:
Tested (Eclipse Indigo) and it worked like a charm.
You can add Bookmarks to the code fragments you think are important to you in eclipse.
I referred this link for the same purpose.

How to enable "live search" in eclipse?

In Komodo Edit, an input field is available in the toolbar. When I type text in it, it highlights matching search results. Is there something like this in Eclipse, either directly or via a plugin?
As TK Gospodinov has already mentioned, there is an Incremental option in Find/Replace (Ctrl+F) dialog.
There is also a special key binding for Incremental search in Eclipse (and personally I use it more frequently). From Eclipse Tips and Tricks:
Use Edit > Incremental Find Next (Ctrl+J) or Edit > Incremental Find Previous (Ctrl+Shift+J) to enter the incremental find mode, and start typing the string to match. Matches are found incrementally as you type. The search string is shown in the status line. Press Ctrl+J or Ctrl+Shift+J to go to the next or previous match. Press Enter or Esc to exit incremental find mode.
If you'd like to have search functionality in a toolbar, you may be interested in the eclipse-glance plugin, which allows you to use the incremental search function in a toolbar by pressing Ctrl + Alt + F while in any text area.
This feature is already available in eclipse. No need to install any plug-in.
Press Ctrl+F, and the Find pop up appears.
Now check the incremental checkbox, and then your texts will be found as you type. No need to hit return.
OR
Use Ctrl+J and you can activate the live search, just that there wont be any UI visible, but you can see the status in eclipse status bar at the bottom.
Press Ctrl+J, start typing the text you want to search for. Press esc to go back to edit mode
The closest thing to the functionality you are asking about is the 'incremental search' mode, which is triggered by checking the 'Incremental' checkbox in the Options group on the Find/Replace dialog in Eclipse (Ctrl+F from the code editor). This will make it start highlighting matches as you type, and if they are keywords, Eclipse will highlight other occurrences (references) in the code editor. Matches inside strings or Javadoc will not be highlighted, however, unless it happens to be the first match after your cursor's position inside the editor.
One similar thing (not the same) is just enabling "mark occurences", then selecting function name, variable etc.