How to search only through selected files/folders in IntelliJ? - intellij-idea

I'm coming from eclipse and one of my most used feature is to select fiels/folders in the navigator and then execute a search on those (clicking Ctrl+H => only the selected files/folders are searched recursivly).
Pressing Ctrl+Shift+F in IntelliJ only selects the parent folder or the first folder.
How can I search through my selection in IntelliJ?

You can switch to the Scope tab and select Selected directories/Selected files from the list. E.g.,
Here is a related request https://youtrack.jetbrains.com/issue/IDEA-92340 to make this feature work better. Feel free to upvote/comment.

Related

How to copy search results in IntelliJ to paste them elsewhere?

I would like to remember my team the ports used for debugging, for several projects.
A Ctrl-F in a directory, and I have my results under IntelliJ_2021.1.3 Ultimate I'm using,
but I have no way to paste them, like they are on this window, either with Ctrl-C or Ctrl-Ins , on another location in order to send a mail to my teammates.
Does a workaround exist, or has this feature been implemented in a later version I should try to upgrade to?
I don't think there is a simple and direct way to do what you want. However, there is a workaround:
Run your search, and then from the Find in Files window click the Open in Find Window button:
Right-click anywhere within that Find window listing the occurrences, then select Export to Text File from the context menu:
An Export Preview window will open, showing the search results in expanded hierarchical form, reflecting the structure under the directory you searched. Within that window you can select any contiguous portion of text, then right click and select Copy from the context menu:
You can then paste the selected text into any other window, and massage the results as necessary:
Notes:
This is only a workaround because unfortunately I don't see a way to directly copy the results in your screen shot, in which each line shows a both a search occurrence and its file location. That information is still in the copied text, but it may take a bit of effort to get it in the form you want.
The Copy button in the Export Preview window ignores any text selection and blindly copies everything, so use Copy from the context menu instead if selecting a subset of the text.
I used IntelliJ IDEA 2023.1 EAP (Ultimate Edition). I don't know whether this functionality exists in your version.

Collapse all Folders on directories tab in SmartSVN Foundation

Is there any way to Collapse all folder on the Directories Tab in SmartSVN Foundation 8.0.1?
I Accidentally pressed Ctrl+A (Select All) and ALL THE FOLDERS COLLAPSED!
Now if i want to add a specific folder i need to collapse some or all... or most, but there's no easy way to do it, right now i'm doing it one by one, but the vendor folder (all composer packages) is enormous.
Any ideas?
Seems odd. I've tried to replicate this and have been unable (I'm assuming you're on Windows?) even if I select all and then click the collapse icon on one folder it just collapses that folder.
More than happy to raise a feature request for you if you could give me a bit more detail about what you're after? For example, adding a 'collapse/expand all' and/or a 'collapse/expand selected' option to the View menu that you could set a custom shortcut for in the Edit -> Customize -> Accelerators options?

How to expand folder branch in Project Window Intellij IDEA?

Sometimes I close folder/package in Project Tool Window and then I should click every folder in it to open them . How to avoid this and open all folders/packages quickly?
* on numpad
Also see IDEA guide about Title bar context menu and customize project window as you need.
Navigate to any folder / package by name! Use the shortcut Shift+Ctrl+N(on Mac ⇧+⌘+N) in the pop-up window type name of folder / package, and end of name add /, for example src/. See here guide for more understanding.
Use the great feature Speed Search for quick navigation:
And also use shortcut Alt+1 to open, Shift+Esc to hide Project Tool Window.
after every press numpad * folders will be expaned more and more

IntelliJ IDEA: how to search for a folder / directory / package name?

I wish to search just directory (folder) names and packages within the modules of my current project.
How can I do this?
CTRL+Shift+N allows me to find a
class
CTRL+Shift+Alt+N allows
me to find a symbol
Is there a function for that allows me to search just directories, folders and package names?
I'd like the result of this search to be that the directory / package sought is highlighted in the "Project" box.
For example, if I type in "model.feed" then then I get this:
and preferably while I'm typing that a list of any directories matching would be shown in real time (in the same way as classes are when you do CTRL+Shift+N).
I'm using IntelliJ IDEA 12.0.4 (Ultimate).
In IntelliJ IDEA 13, you can use Goto File (Ctrl+Shift+N) and enter the directory/package name with a slash afterwards. Then you'll see all the matching directories in your project.
I propose this as a partial solution to your query.
The following steps will allow you to find a file or directory or package name or jar name that is visible in the project view.
Caveats stated explicitly below, but give this a go.
Click on the root folder in the Project View.
Start typing words that you want to search on to find packages/files/folders/jars in the project view
A tool tip will appear that contains the text Search For: along with the text that you have
entered.
The Project View will then highlight the first folder or file that matches the text that you have entered.
This may be close to what you are looking for.
The only caveat is that this search is constrained to those entities currently visible in the Project View so if you want to search a particular part of the project it appears that you have to expand those folder within the Project View. (From my testing of this in IntelliJ Ultimate Version 11.)
One way to work around this is to go to the root element in your project. Perform a partial traversal of where you want to go then by pressing enter you open the folder that you have landed on and then that search is completed.
Starting typing text again after pressing Enter will recommence the search from the current item in the Project View.
So by experimenting with this feature you can interactively walk around your project in the Project View in a dialog-box-free manner.
As a side note you can use the letters Camel Case style to traverse and find classes in the ProjectView
WINDOWS:
CTRL + SHIFT + N
MACOS:
⌘ command + ⇧ shift + O
If you try
CTRL + SHIFT + F
You can do a global file search (like eclipse CTRL + H).
In the file search, you can select which folder to search for, what file type to search for, case sensitive etc, all the normal stuff.
Global Replace is
CTRL + SHIFT + R
(Mac replace CTRL for CMD)
On mac it is
CMD + Shift + O
at least for intellij 14.1
If you have the file open in the editor and can't figure out the location in the project view
WINDOWS:
ALT + F1
From Select In... pick the first item, Project View
It seems IntelliJ doesn't directly support this. Here are the best alternatives I've thought of so far:
I suggest these steps if there is nothing in the folder yet (Windows):
Windows:
Right click on the project root, and choose "show in explorer"
In the search box on the top right, search for the folder you want (e.g. META-INF)
Right click, "open folder location"
Linux/Unix/Cygwin:
Copy the path instead, (in the right-click menu),
cd to the directory using a console or cygwin,
use the 'find' utility. E.g. type find . -iname 'SomeFolderName*'
If there is already something in the folder, I suggest you do this:
Ctrl-Shift-F to search for files
Enter the directory name inside a wildcard pattern (eg. */META-INF/*)
open the first file that occurs in that folder
Click on the circular target icon to "scroll from source" (at the top of the project panel).
If you find yourself wanting to search for folders/packages often, you can use the Go to File command (Ctrl + Shift + N) and set a filter on Directories so that you can quickly search for directories and packages. The filter will be saved for the next time you use Go to File. As a demonstration:
Use Go to File (Ctrl + Shift + N) and click on the filter icon (funnel-shaped) on the top right of the search box. Disable/unselect all other selections and only keep Directories selected.
Try searching -- you should only see directories and packages in the result.
Try using Go to File again -- you should find that the filter still exists

Enabling tabs in xcode? Or lessening the pain of not having them?

I am currently using xcode and I find it's lack of tabs quite disturbing.
I currently use command-shift-d to search through all the files, or ctrl-1 to open the history of files that were recently opened.
It works but I find it less effective than just tabbing through the few files i am currently working on.
Is there any way, third party or not, to enable some sort of tabbed organization?
If not, is there any other way to quickly navigate through a subset of files?
XCode 4 now supports tabs. You can enable by selecting "View / Show Tab Bar" menu.
Not really, but one alternative is View > Show Favorites Bar and drag five or six frequently-used source files into it. Not as flexible as tabs but satisfies your request for "quickly navigate through a subset of files".
The traditional way is to use the detail view. Get the files you want in the Detail view by one of these means:
Put them all in the same group, then select the group
Enter a filter expression in the Search Bubble that narrows the items shown
Define a Smartgroup that includes just the files you want
Get a list of the files as a Find in Project result, then select that item in Find Results
Then you can use the Detail View as your list of interesting files and navigate through it quickly with the up and down arrows.
First of all, you can use Textmate (which I believe has Xcode integration). Otherwise:
Window (Menu) -> Organizer (ctrl-command-o)
At the bottom of that window, if you don't have two panes, click the square to the right of the gear. Now drag code files of interest to the left, grey pane--a single click or arrow up/down will open the file in the editor pane.
If you do open a bunch of windows, as vog suggested, you'll need to command-~ through them--not alt-tab.
Cheers.
The Xcode source code editor allows you to choose the file from a list. It's two clicks instead of one (as it would be with tabbing), but it's better than nothing.
In addition, you can simply Alt-Tab through your open source code windows. This is not slower than tabbing, and has the same effect since the source code windows are usually placed exactly one in front of another.
You'll definitely want to read through this. (XCode Tips and Tricks you wish you know about two years ago - SO)
You can navigate between files using "Recent Files"
Write simple applescript:
tell application "Xcode"
tell application "System Events"
keystroke "1" using {control down} -- open "Related Files"
key code 125 -- choose "Recent Files" ("keystroke down" doesn't work)
keystroke return -- enter to "Recent Files"
key code 125 -- choose previous file
end tell
end tell
And bind it to some shortcut using for example FastScripts(free up to 10 bindings)
I have this script on "Control" + "`". (XCode 4)
Hope this will help
You may also try an Xcode plugin I've just released - it's called Code Pilot and solves a lot of issues of Xcode's navigation, making it more TextMate/Eclipse-like.
Check it out here: http://macoscope.net/en/mac/codepilot/
I hope this helps!
It is simple with XCode 7.2
GoTo View>>Show Tab Bar
This will show the tab bar.
RightClick on the New Tab and click -->"NEW TAB"
Then We can see all the files in tabs.