Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rename file in PHPStorm without refactoring

How do I quickly rename a file name without refactoring in PHPStorm? Even after I've just created the file, PHPStorm takes a long time to search through my files for its usage.

like image 954
Handsome Nerd Avatar asked Oct 19 '11 06:10

Handsome Nerd


People also ask

How do I rename a file in PhpStorm?

Rename a file or directory Select a desired file in the Project tool window. Choose Refactor | Rename on the main or context menu or press Shift+F6 . In the Rename dialog that opens, specify the new filename. Select the Search in comments and strings checkbox to let PhpStorm apply changes to comments and strings.

Is renaming variable refactoring?

Refactoring variable names involves renaming the variable and then updating usages of the variable that occur elsewhere, such as in the pipeline, other flow services, or document types.

What is the most efficient way to rename a file in a repository?

In your repository, browse to the file you want to rename. In the upper right corner of the file view, click to open the file editor. In the filename field, change the name of the file to the new filename you want. You can also update the contents of your file at the same time.

How do I rename a sequential file?

You can press and hold the Ctrl key and then click each file to rename. Or you can choose the first file, press and hold the Shift key, and then click the last file to select a group.


2 Answers

My technique for renaming files quickly is to single-click the file name and press Shift-F6. A dialog opens and you can immediately type the new name of the file and hit return/enter to complete the rename.

I find this technique intuitive because you don't have to move your mouse to the dialog window, type the new name, or click anything to confirm. As long as all you're doing is a rename that you know is safe, you just type it and go.

I also like this feature because you still have the option of quickly previewing the changes before they're made. And on those occasions when you are refactoring something with possible implications to the rest of your app, you can still enable "Search for references" and/or "Search in comments and strings" to get the whole enchilada. (I have those options disabled by default.)

I agree with you that right-clicking the file name, scrolling down to Refactor, selecting Rename, and then entering the new name is cumbersome, especially if the safe checks are enabled. I find that PhpStorm developers seem to understand these types of issues and usually have thought of a "faster way" to do things as well.

like image 166
cantera Avatar answered Sep 30 '22 23:09

cantera


You can't do it without refactoring, though Refactor | Rename is usually very quick and you can disable options to search for references.

like image 22
CrazyCoder Avatar answered Sep 30 '22 22:09

CrazyCoder