You can open and edit any text file from the File Manager, such as files with html or php extensions, the .htaccess file, and more. It provides a convenient way to work on your files without having to download them to your local device and re-upload them every time.
Making changes to your files may cause errors on your website - create a copy of the file before editing, and proceed with caution!
How to Open the File Editor
To open the File Editor from the File Manager, double-click on the file name. Alternatively, you can right-click on the file and select Edit:
How to Use the File Editor
The File Editor has the following sections and buttons:
Close button - Exits the File Editor
Name of the currently open file
Save button - Saves the changes
Breadcrumb - Shows the path from your website root directory (public_html) to the currently open file
Line numbers - Indicates the line number. It will also show syntax error indicators and the code folding toggle when applicable
Editor Area - Shows the file contents. To start editing the file, click on any line to show the cursor
The editor supports syntax highlighting out-of-the-box for the most common programming languages, marking errors with a ❌ next to the line. Hover on it to find more information about the error:
Once you have finished editing your file, make sure to click on the Save button to apply the changes. If you don't wish to keep them, click on the Close button - a popup will indicate that changes will be lost. Click OK to leave without applying the changes.
The File Editor supports the following keyboard shortcuts:
Ctrl+K or Alt+K
⌘+K or Option+K
Ctrl+Shift+K or Alt+Shift+K
⌘+Shift+K or Option+Shift+K
Go to the next error
Go to the previous error
Ctrl+Y or Ctrl+Shift+Z
⌘+Y or ⌘+Shift+Z
Toggle overwrite mode
Convert selection to uppercase
Delete the whole line
Duplicate selection or current line
Sort selected lines alphabetically
Toggle block comment*
* Available only if the file is written in a supported language.
Editing Blocks of Code
Use the following shortcuts by selecting one or more lines of code - they will be placed above or below the current selection according to the command:
Move lines up
Copy lines up
Move lines down
Copy lines down
If the file is written in a supported language, folding and unfolding will detect code regions and allow expanding/contracting using the toggle fold.
The toggle fold can also be used by clicking on the arrow in the line number section.
Option+L or ⌘+F1
Alt+Shift+L or Ctrl+Shift+F1
Option+Shift+L or ⌘+Shift+F1
That's it! Now you know how to edit your files using the File Editor 🚀