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

前端 未结 5 1045
孤独总比滥情好
孤独总比滥情好 2021-02-12 10:58

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 sel

相关标签:
5条回答
  • 2021-02-12 11:14

    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.

    0 讨论(0)
  • 2021-02-12 11:19

    Ctrl + C on target file/folder

    Ctrl + V on destination folder

    Enter new name and press Enter...

    0 讨论(0)
  • 2021-02-12 11:28

    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.

    0 讨论(0)
  • 2021-02-12 11:29

    ⌥ + drag

    • Mac
      Press Option key and drag the original file.
    • PC
      Press Alt key and drag the original file.

    You will be prompted for a new name.

    enter image description here

    Works for classes too:

    enter image description here

    0 讨论(0)
  • 2021-02-12 11:31

    Pressing Function key+F5 will duplicate selected file, which will prompt you to enter a name.

    0 讨论(0)
提交回复
热议问题