Renaming a file in PyCharm

In PyCharm 3.4, I want to rename a file on the file tree that appears on the left of the IDE. If I right-click on a file, there is an option to delete it, but not to rename it. Similarly, there is no way of renaming it from the File or Edit menus. Is there a fundamental reason why PyCharm does not allow this from within the IDE, or have I missed the correct way of doing it?


Solution 1:

Renaming files in PyCharm is simple. You simply select Refactor > Rename when right-clicking on a file in the tree.

This will open a popup where you can type in the new filename. There are additional options when renaming, such as searching for references and in comments, strings, etc.

NOTE: While PyCharm is indexing files, the option is unavailable. Once indexing is finished (can take a while), it becomes available again (thanks @Eric_Sven_Puudist).

Solution 2:

You can just choose the file and hit shift+F6 rename it then hit refactor