Keyboard shortcut for "open next search result"? - eclipse

Eclipse has this great feature of searching text in Workspace(Ctrl+Alt+G), Project, File or Working Set.
The results are displayed neatly in a Search tab/view and when I double-click (i.e. mouse) a particular line, the file (in which that searched text is found) is open exactly at where the search text is.
Is there a keyboard shortcut for that double-click? To open the next one?

There is not one keyboard shortcut to perform this action that I know of, but there are two of them that could work in sequence.
Go to Window > Prefs > Keys
Search for "Show view search"
Set some custom keyboard shortcut because the default one is too long to be efficient (I like to use Alt+Shift+S)
Perform your search
With the search view in focus double-click the first result
When you are ready to go to next item, use a keyboard shortcut to show search view again (Alt+Shift+S for me)
Then press 'Ctrl+.'
This shortcut will display the next result and open a new file is needed.
So with this sequence you can use two keyboard shortcuts (Alt+Shift+S then Ctrl+.) to do what you want.

Checkout the Eclipse Keyboard Shortcuts PDF list for v2.1, v3.0, and v3.1 HERE

#gamerson has the right answer, but for the future I wanted to make sure you are aware of two key meta keyboard shortcuts:
Ctrl-Shift-L (Command-Shift-L on Mac) - Opens up a searchable list of available shortcuts.
Ctrl-3 (Command-3 on Mac) - Quick Access gives you a searchable, prioritized list of a bunch of stuff - commands, menu items, windows, tabs, etc. It's pretty darn useful.

Related

Generate editable cursor positions on VSCode [duplicate]

In sublime text I used to use a shortcut that allowed me to tab through my multi selection and edit each element individually.
for example I would cmd+d a word then the shortcut would allow me to tab through each selection and edit them individually.
I haven't used sublime text in a month since I switched and can't even remember the shortcut I used to find the name of that action. so I don't even know if it was a plugin or a built in short cut.
is there a similar shortcut in vscode?
You can multi-select in VSCode using alt+click
(can be changed to cmd+click in "Selection -> Switch to Cmd+Click for Multi-Cursor").
To tab through your selections install the tab-through-selections extension and then use cmd+shift+u to start iterating (alternativley ctrl in Windows), then:
tab to go to the next selection
shift+tab to go to the previous selection
click anywhere to cancel iterating
Hope this helps :)

See unsaved changes in vscode

Sometimes when closing vscode, or a tab therein, I get a dialogue asking "Do you want to save the changes you made to filename?" However, the unsaved edits are actually from a previous session that was closed without such a query, probably when turning off the computer, so I can't remember if it was meaningful edits, or maybe just an accidental key-press, like a shortcut gone wrong; and doing undo to revisit the last edits doesn't work either.
My question: How can I see the diff between the saved version of a file, and the version in the editor window? I think it would be nicest just to have a "show diff" option in the dialogue, but for now I'm also happy with a command line diff command.
I'm using ubuntu 20.04.
I'm using VSCode version 1.52.1 on MacOS and I had a similar problem that may not be the same problem, but I'm guessing it will work for you as well.
When you're in the Explorer view, in the upper left part of Explorer you have your "Open Editors." If that shows a dot to the left indicating that the buffer has changes in it, you can right click the file name and select "Compare with Saved." This will open another buffer to the side that will show you any unsaved changes.
To get rid of that window (it took me a bit to figure this out I'm sorry to say!), you can click the 'X' to the left of the extra buffer in "Open Editors."
Hope this works for you!
A few bright notes for the keyboard players out there:
The command you are asking about has a default shortcut. Unless you've applied a keyboard map extension, the Ctrl+Kd arpeggio opens the very same diff view between the active and saved versions of the current file. The default shortcut to close an editor tab (be it the diff or a file or anything at all) is Ctrl+W.
The command, like any command in VSCode, is also accessible via the Ctrl+Shift+P command dropdown (on Linux, F1 opens it too). Start typing e.g. compa sav (it saves your keyboard wear and tear to shorten words to a prefix which is unambiguous enough), and the list will shrink dynamically to just a few commands. Yours is File: Compare Active File with Saved. When it's close to the top enough, navigate the list of commands with the down arrow and execute it with Enter. As a bonus, you may click on the little gear to the right of the command currently highlighted in the list and redefine its shortcut, if you use it very often and prefer a chord shortcut to the default arpeggio one. Sorry, there does not seem to be a shortcut in lieu of the gear click. If there is, please let me know!
But if you really, really want to right-click on the filename in the Open Editors view of the Explorer sidebar, you can open that view directly with, you guessed it, a shortcut: Ctrl+Ke. And if you change your mind on a dime right at this moment, or realize that you in fact never had a mouse to do the right-click in the first place, use Shift+F10 to drop down the "right-click menu", properly called the context menu, which you navigate with arrows and execute with Enter (that's kinda a common theme, as you probably noticed). This works mostly anywhere the right-click does.
While in the Open Editors view, to switch to an editor file tab, move the selection to the desired file. Press Space to bring the file into view but stay in the Open Editors view, or Enter to bring the file into view and shift the keyboard focus to it. Pressing Ctrl+Shift+E brings focus back to the editor from any view in the Explorer sidebar. The same shortcut moves focus to the Explorer sidebar from the editor.
Happy ♬ k'boarding ♬!
ctrl+shift+P (or command+shift+P on mac) and fuzzy search for "compare changes with saved files"

loop through multiple selections and edit individually in vscode

In sublime text I used to use a shortcut that allowed me to tab through my multi selection and edit each element individually.
for example I would cmd+d a word then the shortcut would allow me to tab through each selection and edit them individually.
I haven't used sublime text in a month since I switched and can't even remember the shortcut I used to find the name of that action. so I don't even know if it was a plugin or a built in short cut.
is there a similar shortcut in vscode?
You can multi-select in VSCode using alt+click
(can be changed to cmd+click in "Selection -> Switch to Cmd+Click for Multi-Cursor").
To tab through your selections install the tab-through-selections extension and then use cmd+shift+u to start iterating (alternativley ctrl in Windows), then:
tab to go to the next selection
shift+tab to go to the previous selection
click anywhere to cancel iterating
Hope this helps :)

remove search highlighting via keyboard shortcut in Eclipse

After doing a Java or File search in Eclipse, the (purple) highlighting of matches in files persists indefinitely, distracting me from whatever task I try to accomplish after I complete my search.
I know that I can open the Search view (by pressing Alt+Shift+Q,S, or by clicking its icon) and then click the "Remove All Matches" button that looks like an advertisement for Dos Equis, but I get tired of all this view-activating and clicking.
I want to clear search results in Eclipse using just the keyboard. Is there a way to do this?
Press Ctrl+F7. Keep on Pressing F7 when reach search view. Release Ctrl Key.
Close search view(in fact any view) as explained here
Once search view is removed from the current perspective search highlight will be removed automatically. If you want to see it again then open search view.

Is there a "Find in Files" shortcut in Eclipse?

Is there a "Find in Files" shortcut in Eclipse, as there is in Visual Studio (Ctrl+Shift+F)?
I have looked in these two lists:
Eclipse Shortcuts
"Show All Shortcuts" shortcut: Ctrl+Shift+L.
Thanks.
select workspace and press Ctrl-H
Which dialog is selected, depends on which file type is selected in the Project Explorer view. For example, if you selected a .js file and press Ctrl-H, it will bring up the dialog with the "Javascript Search" tab selected. If you want to search all files, you can press Ctrl-F7 to select the Project Explorer view, use arrow keys to select a folder above your files, then press Ctrl-H (or select a file, whose type doesn't trigger a custom dialog tab).
Thanks to the other two solutions, but here is the complete answer I was looking for, which addresses how I search all the text within the files, not just types, methods, packages, constructors, and fields:
Ctrl+H to open the "Search" dialog box
"File Search" tab, if it does not appear, expand the window or use the left/right arrows
type in the text to search for
Use "*.java", in my case since I am coding in Java, to search just these files
Click "Search"
If you are using only the File Search, you can Disable all other Searches in the Search Panel (Customize... lower left Corner). Then you have the File Search everytime you Press Ctrl+H
Ctrl+H to bring up the search box
Click 'Customize' in the lower left
Checkmark 'Remember last used page'
Click OK.
Select the file search tab and do a search
If you want to use the type-specific search (Java, Javascript ...etc) you can use Ctrl+H, which opens the search dialog, then click the Search button.
If you simply want to search for all text occurrences in the whole the workspace click the word (or select the text) you want to search then hit Ctrl+Alt+G. You will directly get all the found occurrences without even using a dialog box.
I find Ctrl+Alt+G is the best solution because it shows the variable name in different by related files (e.g. Java and XML, or Javascript and HTML) while still having the type-specific search feature available through Ctrl+H
You can rebind the Ctrl+Alt+G to finding text in a project or a working set instead of the whole workspace if that's more appealing to you.
Yes, there is shortcuts for searching Eclipse, these shortcuts are very useful when we search for particular html, jsp , xml, java, properties ,class, jar,search file with keywords.
Ctrl+H is used open Tag, in that you can select type of file Remote Search, File search, git search, java search, javascript search , etc
Ctrl+Shift+R is used to search all files in the current project
Ctrl+Shift+T is used to search all files in the workspace
press Ctrl + H . Then choose "File Search" tab.
additional search options
search for resources press Ctrl + Shift + R
search for Java types press Ctrl + Shift + T
Source: Eclipse: Default to "File Search" Tab in Search Dialog
Go to your key bindings Windows > Preferences > General > Keys
Unbind the Shorcut "Ctrl+H" for the "Open Search Dialog"
Filter/Search for "File Search" and use the "Ctrl+H" here instead.
I believe adding plug-ins power your needs.
If you install Plug-in named InstaSearch it makes your searching faster inside current active working projects.
It shows the result as you type.
http://marketplace.eclipse.org/content/instasearch#.VIp-_5_PGPQ
As pointed out, CTRL + H opens the Search dialog.
Since I use only Find in Files (and set File name patterns when needed), I clicked on Customize... button on the bottom of the Search dialog. It opens Search Page Selection dialog, where I turned off all other options.
You can also click on Remember last used page in the same dialog.
Ctrl+Alt+F (Find Text in Project -Customized Key)
Note - Ctrl+Alt+G is for Find text in a workspace, not in a project
How to customize this Key
Window->Preferance->General->Keys-> Search for 'Find Text in Project'->Type 'Ctrl+Alt+F' in binding ->Apply
Note - this will be helpful if the developer is working on multiple project simultaneously.