> For the complete documentation index, see [llms.txt](https://docs.papert.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.papert.in/papertlab-ui/file-editor.md).

# File Editor

### Accessing the Editor

* In the file tree on the left side of the application, click on any file to open it in the editor.
* The editor will open in a modal window, taking up most of the screen.

<figure><img src="/files/z5fJBwjwgnrpNkSSpWwr" alt=""><figcaption></figcaption></figure>

### Editor Features

#### 1. Syntax Highlighting

* The editor automatically detects the file type based on its extension and applies appropriate syntax highlighting.
* Supported languages include JavaScript, Python, HTML, and CSS.

#### 2. Line Numbers

* Line numbers are displayed on the left side of the editor for easy reference.

#### 3. Auto-Closing Brackets

* The editor automatically closes brackets, parentheses, and quotes as you type.

#### 4. Code Folding

* Click on the arrow icons in the gutter to fold or unfold sections of code.

#### 5. Search and Replace

* Use Ctrl-F (or Cmd-F on Mac) to open the search bar.
* Use Ctrl-H (or Cmd-Option-F on Mac) to open the replace function.

#### 6. Multiple Cursors

* Hold Ctrl (or Cmd on Mac) and click to add multiple cursors.

#### 8. Comment Toggling

* Use Ctrl-/ (or Cmd-/ on Mac) to toggle comments for the selected lines.

#### 9. Indentation

* The editor maintains proper indentation as you type.
* Use Tab to indent and Shift-Tab to un-indent.

### Saving Changes

* Changes are automatically saved when you close the editor.
* Click the "Close" button in the top-right corner of the editor to save and close.

### Keyboard Shortcuts

* Ctrl-F / Cmd-F: Find
* Ctrl-H / Cmd-Option-F: Replace
* Ctrl-/ / Cmd-/: Toggle comment
* Ctrl-Z / Cmd-Z: Undo
* Ctrl-Y / Cmd-Shift-Z: Redo
* Tab: Indent
* Shift-Tab: Un-indent

### Language Support

The editor provides enhanced support for:

* JavaScript
* Python
* HTML
* CSS

For other file types, basic syntax highlighting and editing features are still available.

### Best Practices

1. The editor auto-saves on close
2. Use code folding for long files to improve navigation.
3. Utilize multiple cursors for efficient batch editing.

### Troubleshooting

* If syntax highlighting isn't working correctly, check if the file has the correct extension.
* If you encounter any issues, try refreshing the page or reopening the file.

For any persistent issues or feature requests, please contact the development team.

### Auto-Commit Feature

When enabled, papertlab automatically commits changes to your Git repository. To toggle:

1. Go to Settings.
2. Find the "Auto-Commit" toggle.
3. Turn it on or off as desired.
