The following tutorial column of phpstorm will introduce to you how phpstorm can save (ctrl s) and format the code at the same time. I hope it will be helpful to friends in need!

##1. Select Edit->Macros->Start Macro Recording, as shown below:

2. Directly press the shortcut key you want to record, Ctrl ALT L, Ctrl S, and then click the little red dot in the picture below.

3. Then enter Format And Save (you can enter the name at will, as long as you can remember it)

4. In File->Settings->Keymap->Macros, find the "Format And Save" you just added, right-click "add keyboard shortcut", enter the shortcut key "Ctrl S", and click "OK" . At this point, the automatic formatting of code saving (Ctrl S) is completed. Go and try it now.

Note: If it is a Chinese version of phpstorm, some will not be able to enter "Settings". Please find the language resource package (installation directory, under lib) and temporarily restore it to the English package. , restart phpstorm, enter the settings, and after the modification is successful, restore it to Chinese.

The above is the detailed content of How to use phpstorm to save (ctrl+s) and format the code at the same time. For more information, please follow other related articles on the PHP Chinese website!