'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.



Solution 1:[1]

F5 will duplicate selected file prompting you to enter a name for the new file.

Solution 2:[2]

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.

Solution 3:[3]

Ctrl + C on target file/folder

Ctrl + V on destination folder

Enter new name and press Enter...

Solution 4:[4]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ross Attrill
Solution 2
Solution 3 Kwame Opare Asiedu
Solution 4 User1