Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pycharm - how can I copy a file (tab) in pycharm (to a new tab)?

Tags:

python

pycharm

Just got started with pycharm and was wondering how can I simply copy a file in pycharm for editing purposes? For instance, I have a file opened, want to edit the code but want to make sure that I do not accidentally "over-save" the original file.

In other environments, I can simply right click the file, and copy it to a new file. I do not see a 'copy to new file' option in pycharm, but instead I do have to manually open a new file (File>New>Python..), and then manually copy all the code from the original file and paste it in the empty new file.

Am I missing something or is that not possible in pycharm?

like image 206
pythonbrutus Avatar asked Dec 06 '16 21:12

pythonbrutus


People also ask

How do I copy a file path in PyCharm?

Press Ctrl+Shift+C to copy the absolute path to the current file. Choose Edit | Copy Path/Reference from the main menu.

How do I add a tab in PyCharm?

To reopen the closed tab, right-click any tab, and from the context menu, select Reopen Closed Tab. To open a new tab at the end of the already opened one, select the Open new tabs at the end in the tab settings.

How do I copy and paste in PyCharm terminal?

If plain Ctrl+C and Ctrl+V don't work your terminal may require that you also hold down the Shift key to do copy & paste.


2 Answers

If I understood well, you are looking for to a something similar duplicate functionality.

So to do this, you can simply go to the project structure (the panel to the left) and copy the file in this way:

  • simply Ctrl + c
  • Right click on choosen file > Copy

After this, paste your file in the directory that you want in this way:

  • simply Ctrl + v
  • Right click on choosen directory > Paste

In this way you have the possibility to duplicate the choosen file with another name.

like image 103
Giordano Avatar answered Oct 11 '22 15:10

Giordano


Select the file in the Project or Project Files pane and then hit File>Save as... The save-as dialog that pops up has an option (checked by default) to "open copy in editor". Not exactly what you asked for but it's the easiest way I could find.

like image 33
Frank Niessink Avatar answered Oct 11 '22 17:10

Frank Niessink