Code Editor
Edit code with syntax highlighting, inline diffs, grammar check, AI selection actions, and LaTeX autocomplete.
Omnilib's Code Editor provides a powerful environment for writing and editing code. With automatic language detection, syntax highlighting, inline AI edits, grammar checking, and a selection action toolbar, it's designed for both code and writing-heavy files.
Overview
The Code Editor offers:
- Syntax highlighting — Automatic language detection from file extension
- Theme support — Light, Dark, and Omni color schemes
- Inline diff — Accept or reject AI-proposed edits line by line
- Grammar check — Wavy underlines for prose errors with explanations
- Selection action toolbar — AI actions on any selection
- LaTeX autocomplete — Commands, environments, citations, and references
- Voice input — Dictate code comments and prose (desktop only)
- Edit/View mode — Toggle between editing and read-only
- Undo/Redo — Full history support
Getting Started
Opening a Code File
Click any code file in the sidebar:
.js,.ts,.jsx,.tsx— JavaScript/TypeScript.py— Python.go,.rs— Go, Rust.html,.css,.scss— Web- And 50+ more languages
Edit vs View Mode
Files open in view mode by default. Click the pencil icon in the toolbar to enter edit mode.
Inline Diff
When the AI proposes edits to your code, they appear as an inline diff directly in the editor:
- Added lines — Shown in green
- Removed lines — Shown in red
- Unchanged lines — Normal display
Each changed region has Accept and Reject buttons in the gutter. Click Accept to apply the change or Reject to dismiss it. Use Accept All and Reject All in the toolbar to handle all pending changes at once.
The inline diff is non-destructive — your original code is preserved until you accept a change.
Grammar Check
The grammar check extension analyzes prose content in comments, strings, and Markdown-adjacent files. Issues are marked with wavy underlines:
| Color | Severity |
|---|---|
| Red wavy | Grammar errors |
| Amber wavy | Style suggestions |
| Blue wavy | Convention notes |
Hover over any underlined text to see an explanation of the issue and the suggested correction. Click Accept in the hover tooltip to apply the fix, or Dismiss to ignore it.
Navigate between issues with the Previous and Next buttons in the toolbar (or the grammar check panel if open).
Selection Action Toolbar
Select any text in the editor to reveal the selection action toolbar above your selection:
| Action | What it does |
|---|---|
| Add as Context | Sends the selection to the AI as context |
| Explain | AI explains the selected code or text |
| Improve | AI rewrites the selection as an inline edit |
| Comment | Adds a review comment anchored to the selection |
The Improve action uses the inline diff system — the suggestion appears in the editor as a diff for you to accept or reject.
LaTeX Autocomplete
When editing .tex files, the code editor provides rich autocomplete for LaTeX:
- Type
\to trigger command completions - Type
\begin{to see available environment names - Type
\cite{to see all entries from.bibfiles in your project - Type
\ref{to see all labels defined in your project - Type
\include{or\input{to see available.texfiles - Type
\usepackage{to see known package names
Select a completion and press Tab or Enter to insert it.
Voice Input
Desktop only.
Press and hold Cmd+R to dictate. Speech is transcribed and inserted at the cursor position when you release the key. Voice input works well for writing code comments and docstrings.
.gitignore Quick Actions
Right-click any file or folder in the project sidebar while the code editor is active to see .gitignore quick actions:
- Add to .gitignore — Appends the selected file or pattern to
.gitignore - Show ignored files — Toggles display of ignored files in the sidebar
If no .gitignore exists in the project root, the action creates one automatically.
Language Support
Automatic Detection
| Extensions | Language |
|---|---|
.js, .jsx, .mjs, .cjs | JavaScript |
.ts, .tsx | TypeScript |
.py, .pyw | Python |
.rs | Rust |
.go | Go |
.html | HTML |
.css, .scss, .less | CSS |
.json, .yaml, .yml | Data |
.md, .mdx | Markdown |
.sql | SQL |
.tex | LaTeX |
And many more.
Themes
The editor adapts to your chosen Omnilib theme:
- Light — Clean white background, GitHub-inspired colors
- Dark — Dark background, GitHub Dark-inspired colors
- Omni — Warm sepia tones with a unique palette
Theme changes apply instantly across all open editors.
Toolbar
| Button | Action |
|---|---|
| Undo | Revert last change |
| Redo | Restore undone change |
| Save | Save current file |
| Edit Toggle | Switch edit/view mode |
| Accept All | Accept all pending inline diffs |
| Reject All | Reject all pending inline diffs |
Keyboard Shortcuts
Editing
| Action | Mac | Windows |
|---|---|---|
| Undo | Cmd+Z | Ctrl+Z |
| Redo | Cmd+Shift+Z | Ctrl+Shift+Z |
| Save | Cmd+S | Ctrl+S |
| Voice input | Cmd+R (hold) | — |
Navigation
| Action | Mac | Windows |
|---|---|---|
| Start of line | Cmd+Left | Home |
| End of line | Cmd+Right | End |
| Start of file | Cmd+Up | Ctrl+Home |
| End of file | Cmd+Down | Ctrl+End |
Troubleshooting
Syntax Not Highlighted
- Check that the file extension is correct.
- Rename to a standard extension if needed.
Can't Edit File
- Ensure you're in edit mode (pencil icon in toolbar).
- Check file permissions.
Inline Diff Not Appearing
- Inline diffs require an active AI session with the current file open.
- Ask the AI to make a specific change to trigger the diff.
LaTeX Autocomplete Not Showing
- Ensure the file has a
.texextension. - Check that your
.bibfiles are in the same project for citation completions.