Shortcut to find where opened tab / file is placed in project structure view in IntelliJ - intellij-idea

In IntelliJ Idea 13 I have opened tab with file i.e. file.js - how I can quickly navigate to this file location in Project structure view?
I can use Copy Path but then I must paste it somewhere and the same with Open in explorer option.
I want to do this quickly in IDE.

Alt + F1, 1
or
Alt + F1, Enter

Related

In Intellij IDEA how to compare 2 text files that are not part of an open project

I would like to compare 2 files in intellij. Both files are not part of a specific project.
Is there a way to do so?
I am running Intellij 15 and 16.
The following works for me in IntelliJ IDEA Ultimate 14.1.7 on Windows:
Open the first file in the IDE (either by dragging from Windows Explorer into the window, or by File / Open).
In the view menu, choose "Compare With…"
In the "Select Path" dialog that appears, select the second file (either directly, or by dragging from Windows Explorer into the dialog).
It then opens up in the traditional file comparison pane. If you try to edit one of the files, it presents the usual "Are you sure you want to edit a file that's not in your project" dialog, which one can accept if that's what one is trying to do.
You can use the "compare with clipboard" feature.
From https://www.jetbrains.com/help/idea/2016.1/comparing-files.html#clipboard:
Comparing a File in the Editor with the Clipboard Contents
Open the desired file in the editor.
Right-click the editor pane and
choose Compare with Clipboard on the context menu.
View and manage
differences in the Differences Viewer for Files.
You can use intellij to compare 2 files/clipboard/blank text etc
Use command Shift+Command+A to search Actions
Type "Open Blank Diff Window" to compare random text
type diff for all diff options.
I use this on the command line (with IntelliJ IDEA CE on a Mac):
/Applications/IntelliJ\ IDEA\ CE.app/Contents/MacOS/idea diff ~/Junk/file1.txt ~/Junk/file2.txt
Window > Editor Tabs > Split Vertically
Is that what you're looking for? It's what I was looking for.
Worked for me on Mac OS High Sierra + IntelliJ IDEA 2018.3
- File -> Open
- Select file 1
- View -> Compare with ...
- Select file 2
To use intelli's difference comparison between 2 different files, you can use the Compare With (Right click the file in Project window). There is also an option to Compare File in Editor. To use that option, ensure one file is open and selected, then right click the 2nd file, clicking Compare File in Editor

IntelliJ: Quickly show file path

How can I see the file path of the current file I am editing in IntelliJ? I can hover over the tab for a file, but it takes a few seconds and I have to keep my mouse still to see the path, which I can't copy.
If you just want to copy the file path you can use Ctrl + Shift + C.
You can also search for action with (Ctrl + Shift + A) (for mac Command + Shift + A) and then it will show you the Keyboard shortcut for particular action.
If you want to change the Keymap you can open setting page and search for Keymap.
If you look at the picture there is a Keymap for File Path which will open a pop up like below
Which is also shows the file path.
View->Appearance->Navigation Bar (check)

Shortcut for locate current file in Project Explorer in IntelliJ?

I read this post:
Locate current file in IntelliJ
Still the problem is that I do not want to have Autosccroll from Source enabled because my Project Explorer will be jumping up and down. Rather I need a shortcut to locate the current file in the Project explorer when I need to. ALT + F1 does work but you need to select from a context menu where you would like the file to be shown. In Resharper for example the shortcut is ALT+SHIFT+L but I am not able to find such a shorcut in IntelliJ?
There is no shortcut for this action in IntelliJ IDEA other than Alt-F1.
There is no default way of doing this.
I can think of 4 options:
You can install the plugin 'Scroll From Source' which will allow you set such a shortcut in the keymap settings (Default: Meta + Ctrl + S)
Use the target symbol in the project explorer, no shortcut but is default option.
Get used to having to press Alt + F1 and then Enter
Record a macro for the above key presses but this may be unreliable. You could then assign a shortcut key to play this marco.

intelliJ idea show active panel in Project window

As the title,
I want to use compare function.
Compare files func need to select one file in Project window, then I can use "Compare file with editor".
There's a problem :
I need to find the file step by step by clicking folder in Project window.
Is there anyway to show active panel in Project window quickly?
Press Alt + F1 or click on that symbol in the project panel:
Source

Intellij: How to copy/paste a file in order to duplicate it?

I can not seem to find a way to do this? I have a file named X in some folder, I want to create Y with the same contents in the same directory. The way I do in eclipse is to select the file and ^C, ^P, eclipse prompts for the new name.
UPDATE
Apparently this problem only occurs if compilation unit contains more than one type.
F5 will duplicate selected file prompting you to enter a name for the new file.
⌥ + drag
MacPress Option key and drag the original file.
PCPress Alt key and drag the original file.
You will be prompted for a new name.
Works for classes too:
As for a keyboard only solution to duplicate a file in IntelliJ:
On Linux:
Press Alt+Home to activate the navigation bar, then either press F5, or press Ctrl+C to copy the file and then press Ctrl+V to paste it, a dialog will appear to name your new file.
On Mac:
Press Cmd+Up to activate the navigation bar, then either press F5, or press Cmd+C to copy the file and then press Cmd+V to paste it, a dialog will appear to name your new file.
I found that ctrl+c/ctrl+v will not copy files on IDEA in Linux (using x2go to connect on a Windows box). I was able to get it working if I close xclipboard but then copying between Windows and Linux dialogs stops working.
Ctrl + C on target file/folder
Ctrl + V on destination folder
Enter new name and press Enter...