# Documentation

> For scripting, see the [API Reference](/api/).

## Welcome to Peeknext

Peeknext is configured using a single human-readable configuration file.
The configuration format is designed to be simple to edit, version control, and share.
Most settings can be changed without restarting the editor unless otherwise noted.

Open the configuration file at any time with <kbd>⌘<span>command</span></kbd> <kbd>,</kbd> or <kbd><span>Open config file</span></kbd> from the Command Palette.

The [latest default configuration](https://github.com/peeknext/peeknext/blob/main/.hackerman) is always available from our [GitHub](https://github.com/peeknext/peeknext).

## The configuration file

The configuration file is divided into sections:

<pre class="editor-mockup language-hackerman-config"><code>
<span class="config-header-syntax">[license]</span>

path_to_license_file                <span class="comment-syntax">-- path to license file, /path/to/license.json</span>

<span class="config-header-syntax">[editor]</span>

font                                <span class="config-string-syntax">SF Mono</span>
font_size                           <span class="config-number-syntax">14</span>

<span class="comment-syntax">...</span>

<span class="config-header-syntax">[models]</span>

code_completion                     <span class="comment-syntax">qwen2.5-coder:1.5b</span>
inline_chat                         <span class="comment-syntax">glm-5.3-flash:cloud</span>

<span class="config-header-syntax">[keybinds]</span>

new_file                            <span class="comment-syntax">Cmd + N</span>
new_window                          <span class="comment-syntax">Cmd + Shift + N</span>
open_file                           <span class="comment-syntax">Cmd + O</span>
save_file                           <span class="comment-syntax">Cmd + S</span>

<span class="comment-syntax">...</span>

<span class="config-header-syntax">[user]</span>

word_count                          <span class="comment-syntax">Cmd + J</span>
</code></pre>

Sections can be removed or commented out if not needed.
Theme names are their own sections, like this:

<pre class="editor-mockup language-hackerman-config"><code>
<span class="config-header-syntax">[koi-dark]</span>

background                          <span class="comment-syntax">#1f272a</span>
foreground                          <span class="comment-syntax">#f7f7f4</span>
text_color                          <span class="comment-syntax">#ffffff</span>

<span class="comment-syntax">...</span>

<span class="config-header-syntax">[dracula]</span>

background                          <span class="comment-syntax">#282A36</span>
foreground                          <span class="comment-syntax">#6272A4</span>
text_color                          <span class="comment-syntax">#F8F8F2</span>

<span class="comment-syntax">...</span>
</code></pre>

See [Appearance](#appearance).

### [license]

<pre class="editor-mockup language-hackerman-config"><code>
<span class="config-header-syntax">[license]</span>

<span class="comment-syntax">-- Peeknext is free for non-commercial use.
-- For commercial use, purchase a license at:
-- https://peeknext.com/</span>

path_to_license_file                <span class="comment-syntax">-- path to license file, /path/to/license.json</span>
</code></pre>

Set `path_to_license_file` to the absolute path of your Peeknext license file, for example `/Users/michael/license.json`.

**Peeknext is free for non-commercial use.
A license is required for commercial use.**

License files are delivered after purchase and can be stored anywhere on your system.
License verification works entirely offline, without an account or internet connection.

For teams and businesses, the license file can be placed in a shared location and referenced by multiple installations, subject to the purchased license's user limit.
If no valid license is configured, Peeknext operates in non-commercial mode.

### [editor]

<pre class="editor-mockup language-hackerman-config"><code>
<span class="config-header-syntax">[editor]</span>

font                                <span class="config-string-syntax">SF Mono</span>
font_weight                         <span class="comment-syntax">-- light, normal, medium, bold</span>
font_size                           <span class="config-number-syntax">14</span>

line_extra_height                   <span class="config-number-syntax">2</span>
tab_width                           <span class="config-number-syntax">4</span>

theme                               <span class="config-string-syntax">adaptive</span>
adaptive_theme                      <span class="config-string-syntax">koi, koi-dark</span>

auto_indent                         <span class="config-string-syntax">true</span>
auto_complete                       <span class="config-string-syntax">true</span>

file_explorer_root                  <span class="comment-syntax">-- absolute path; default: Desktop</span>
file_types_to_exclude               <span class="config-string-syntax">.dmg, .app, .git, ...</span>

files_to_open_on_startup            <span class="comment-syntax">-- comma-separated absolute paths</span>

inline_command_in_files             <span class="config-string-syntax">txt, md, org</span>
inline_shell_symbol                 <span class="comment-syntax">%</span>
inline_chat_symbol                  <span class="comment-syntax">></span>

bookmark_prefix                     <span class="comment-syntax">!></span>
annotation_words                    <span class="comment-syntax">TODO, NOTE, MARK, FIXME</span>

scripts_enabled                     <span class="config-number-syntax">false</span>
allow_unsafe_scripts                <span class="config-number-syntax">false <span class="comment-syntax">-- allow imports</span>

click_on_links                      <span class="config-number-syntax">false <span class="comment-syntax">-- if false, use an inline command to activate</span>

accept_auto_completion              <span class="comment-syntax">-- tab, newline, move_caret_line_end; default: newline</span>
accept_code_completion              <span class="comment-syntax">-- tab, newline, move_caret_line_end; default: tab</span>
</code></pre>

| Setting                       | Description   |
|:------------------------------|:--------------|
| `font`                        | Editor font. Uses installed fonts or fonts placed in `~/Library/Application Support/Peeknext/fonts`. |
| `font_weight`                 | Font weight: `light`, `normal`, `medium`, or `bold`. |
| `font_size`                   | Editor font size in points. |
| `line_extra_height`           | Additional vertical spacing between lines, in pixels. |
| `tab_width`                   | Display width of tab characters, measured in spaces. |
| `theme`                       | Editor color theme. Use `adaptive` to follow the system appearance. |
| `adaptive_theme`              | Light and dark themes used when `theme` is set to `adaptive`, respectively. |
| `auto_indent`                 | Automatically indent new lines based on the preceding line. |
| `auto_complete`               | Enable context-aware text auto complete. |
| `file_explorer_root`          | Default root directory for the File Explorer and project-wide search. Defaults to Desktop. |
| `file_types_to_exclude`       | Comma-separated files, directories, or extensions excluded from file navigation. |
| `files_to_open_on_startup`    | Comma-separated absolute paths to files opened when Peeknext starts. |
| `inline_command_in_files`     | File extensions in which inline commands are enabled. |
| `inline_shell_symbol`         | Prefix used to execute shell commands inline. |
| `inline_chat_symbol`          | Prefix used to invoke inline chat. |
| `annotation_words`            | Words recognized as annotations, such as `TODO` and `FIXME`. |
| `scripts_enabled`             | Enable user-defined scripts. |
| `allow_unsafe_scripts`        | Allow scripts to import Python modules. |
| `click_on_links`              | Enable opening links by clicking them. When disabled, links can be activated through an inline command. |
| `accept_auto_completion`      | Additional keys or actions that accept auto complete suggestions. |
| `accept_code_completion`      | Additional keys or actions that accept code completion suggestions. |

#### User interface

Show or hide individual elements of the editor interface.

<pre class="editor-mockup language-hackerman-config"><code>
<span class="comment-syntax">-- ui</span>

show_line_numbers                   <span class="config-number-syntax">true</span>
show_scrollbar                      <span class="config-number-syntax">true</span>
show_minimap                        <span class="config-number-syntax">false</span>
show_indent_guides                  <span class="config-number-syntax">true</span>
show_annotations                    <span class="config-number-syntax">true</span>
show_ui_borders                     <span class="config-number-syntax">false</span>
show_splitter_handle                <span class="config-number-syntax">false</span>
</code></pre>

| Setting                | Description |
|:-----------------------|:------------|
| `show_line_numbers`    | Show line numbers in the editor margin. |
| `show_scrollbar`       | Show the vertical scrollbar. |
| `show_minimap`         | Show the document minimap. |
| `show_indent_guides`   | Show vertical indentation guides. |
| `show_annotations`     | Show annotations, such as `Lines folded`. |
| `show_ui_borders`      | Show borders around editor interface elements. |
| `show_splitter_handle` | Show the handle between split editor views. |

#### Cursor

Configure the cursor size, shape, line highlighting, blinking, and trail effect.

<pre class="editor-mockup language-hackerman-config"><code>
<span class="comment-syntax">-- cursor</span>

cursor_width                        <span class="config-number-syntax">2</span>
cursor_extra_height                 <span class="config-number-syntax">8</span>

cursor_as_block                     <span class="config-number-syntax">false</span>
cursor_line_highlight               <span class="config-number-syntax">true</span>

cursor_blink                        <span class="config-number-syntax">false</span>
cursor_blink_period                 <span class="config-number-syntax">530</span> <span class="comment-syntax">-- milliseconds; default: 530</span>

cursor_trail_effect                 <span class="config-number-syntax">false</span>
</code></pre>

| Setting                 | Description |
|:------------------------|:------------|
| `cursor_width`          | Cursor width in pixels. |
| `cursor_extra_height`   | Additional cursor height in pixels. |
| `cursor_as_block`       | Display the cursor as a block instead of a vertical line. |
| `cursor_line_highlight` | Highlight the line containing the cursor. |
| `cursor_blink`          | Enable cursor blinking. |
| `cursor_blink_period`   | Cursor blink interval in milliseconds. Default: `530`. |
| `cursor_trail_effect`   | Enable a visual trail effect when the cursor moves. |

#### Statusbar

Choose which file, editor, and model information is displayed in the status bar.

<pre class="editor-mockup language-hackerman-config"><code>
<span class="comment-syntax">-- statusbar</span>

show_line_info                      <span class="config-number-syntax">true</span>
show_file_explorer_root             <span class="config-number-syntax">true</span>
show_file_with_path                 <span class="config-number-syntax">false</span>
show_model_info                     <span class="config-number-syntax">true</span>
show_active_lexer                   <span class="config-number-syntax">true</span>
</code></pre>

| Setting                   | Description |
|:--------------------------|:------------|
| `show_line_info`          | Show the current line and column information. |
| `show_file_explorer_root` | Show the current File Explorer root directory. |
| `show_file_with_path`     | Show the current file name with its full path. |
| `show_model_info`         | Show information about the active AI model. |
| `show_active_lexer`       | Show the active syntax highlighting lexer. |

#### Miscellaneous

Additional settings for interface typography, scrolling, line endings, terminals, opacity, whitespace, and rulers.

<pre class="editor-mockup language-hackerman-config"><code>
<span class="comment-syntax">-- misc</span>

ui_font                             <span class="config-string-syntax">SF Mono</span>
ui_font_weight                      <span class="comment-syntax">-- default: normal</span>
ui_font_size                        <span class="comment-syntax">-- default: 12pt</span>

scrollbar_width                     <span class="config-number-syntax">4</span>
minimap_width                       <span class="config-number-syntax">64</span>

open_on_largest_screen              <span class="config-number-syntax">true</span>

eol_mode                            <span class="config-string-syntax">lf</span> <span class="comment-syntax">-- crlf, cr, lf</span>
eol_symbols_visible                 <span class="config-number-syntax">false</span>

terminal_to_use                     <span class="comment-syntax">-- Ghostty, Warp; default: Terminal</span>

window_opacity                      <span class="config-number-syntax">1</span>
selection_opacity                   <span class="config-number-syntax">0.2</span>
indent_guides_opacity               <span class="config-number-syntax">0.1</span>
whitespace_opacity                  <span class="config-number-syntax">0.1</span>

whitespace_symbol                   <span class="config-string-syntax">▪</span>

vertical_rulers                     <span class="comment-syntax">-- comma-separated list of columns</span>
</code></pre>

| Setting                   | Description |
|:--------------------------|:------------|
| `ui_font`                 | Font used for interface elements. |
| `ui_font_weight`          | Interface font weight. Default: `normal`. |
| `ui_font_size`            | Interface font size in points. Default: `12`. |
| `scrollbar_width`         | Width of the vertical scrollbar in pixels. |
| `minimap_width`           | Width of the document minimap in pixels. |
| `open_on_largest_screen`  | Open new windows on the largest connected display. |
| `eol_mode`                | Line ending format: `lf`, `crlf`, or `cr`. |
| `eol_symbols_visible`     | Show line ending symbols in the editor. |
| `terminal_to_use`         | Terminal application used to open external terminals. Supports `Ghostty`, `Warp`, or the default macOS Terminal. |
| `window_opacity`          | Window opacity, from `0` (transparent) to `1` (opaque). |
| `selection_opacity`       | Opacity of text selection highlights, from `0` to `1`. |
| `indent_guides_opacity`   | Opacity of indentation guides, from `0` to `1`. |
| `whitespace_opacity`      | Opacity of visible whitespace symbols, from `0` to `1`. |
| `whitespace_symbol`       | Character used to represent visible whitespace. |
| `vertical_rulers`         | Comma-separated list of column positions at which to display vertical rulers. |

TODO: add all config sections here, then refer to usage for explanation.

### [models]

<pre class="editor-mockup language-hackerman-config"><code>
<span class="config-header-syntax">[models]</span>

<span class="comment-syntax">-- code_completion                     qwen2.5-coder:1.5b</span>
<span class="comment-syntax">-- inline_chat                         gpt-oss:120b-cloud</span>
</code></pre>

See [Usage](#usage).

### [keybinds]

All editor commands and active key bindings are listed in the Command Palette.

<pre class="editor-mockup language-hackerman-config"><code>
<span class="config-header-syntax">[keybinds]</span>

new_file                            <span class="comment-syntax">Cmd + N</span>
new_window                          <span class="comment-syntax">Cmd + Shift + N</span>
open_file                           <span class="comment-syntax">Cmd + O</span>
save_file                           <span class="comment-syntax">Cmd + S</span>
save_file_as                        <span class="comment-syntax">Cmd + Shift + S</span>

<span class="comment-syntax">...</span>
</code></pre>

Multiple key bindings can be assigned to the same editor command by separating them with commas, or omitted to only be called via Command Palette.
    
<pre class="editor-mockup language-hackerman-config"><code>
<span class="comment-syntax">...</span>

extend_selection_back_word          <span class="comment-syntax">Option + Shift + Left,  Option + Shift + B</span>
extend_selection_forward_word

<span class="comment-syntax">...</span>
</code></pre>

Use `Comma` for `,`, `Period` for `.`, `Plus` for `+`, and `Minus` for `-`.

See [Editor commands](#editor-commands) for all available editor commands.

### [user]

This is where you assign key bindings to your own functions.

<pre class="editor-mockup language-hackerman-config"><code>
<span class="config-header-syntax">[user]</span>

word_count                          <span class="comment-syntax">Cmd + J</span>
</code></pre>

See [API Reference](/api/).

## Usage

Peeknext provides keyboard-driven editing, document-based auto completion, optional AI code completion, inline commands, and file navigation.
Most functionality is accessible through the Command Palette.

### Command Palette

The Command Palette provides access to editor commands without requiring keyboard shortcuts.

Open it with <kbd>⌘⇧P</kbd>.

Start typing to filter available commands by name.
Select a command using the arrow keys and press Return to execute it.

The Command Palette can be used to perform editing operations, navigate files, change editor settings, and access commands without remembering their keyboard shortcuts.

Commands include:

- File operations, such as saving, reopening, and reloading documents.
- Editing operations, including indentation, sorting, and line manipulation.
- Navigation, selections, and multi-cursor editing.
- Changing line endings, tab width, and syntax highlighting.
- Opening editor panels and switching between views.

Commands can also be assigned custom keyboard shortcuts in the `[keybinds]` configuration section.

See [Editor commands](#editor-commands) for the complete list of available commands and their descriptions.

### Editing

Peeknext supports automatic indentation, configurable tab width, multiple selections, and multi-cursor editing.
Indentation behavior can be configured using `auto_indent`, `tab_width`, and `tabs_over_spaces` in `[editor]`.

#### Multi-cursor editing

Multiple cursors allow you to edit several locations in a document simultaneously.
You can create multiple cursors using:

- <kbd>⌘<span>Click</span></kbd> to add a cursor at the clicked position
- <kbd>⌥<span>Drag</span></kbd> to add cursor vertically across multiple lines
- Add cursors on adjacent lines using editor commands
- Select additional occurrences of the current selection
- Place a cursor at the beginning of each selected line

Each cursor supports normal text insertion, deletion, and selection operations.
Use the corresponding commands in the Command Palette to remove the last cursor or merge multiple cursors into one.

#### Tab multi-select

Peeknext supports selecting multiple tabs, allowing several files to remain active together.
Use the tab selection commands to extend the current selection.

| Command                   | Description                                   |
|:--------------------------|:----------------------------------------------|
| `next_tab_extend`         | Extend the selection to the next tab.         |
| `previous_tab_extend`     | Extend the selection to the previous tab.     |
| `extend_to_buffer_1` - `extend_to_buffer_9` | Extend the selection to a specific buffer position. |
| `unselect_other_active_tabs` | Deselect other tabs, leaving only the current tab selected. |

Normal tab navigation remains available through `next_tab`, `previous_tab`, and `switch_to_buffer_1` through `switch_to_buffer_9`.
Tab selection is independent of text selection within a document.

#### Multiple views

Peeknext supports multiple editor views within the same window and same editor view in multiple windows.

Use Toggle split editor to show or hide a second view of the active document.
This is the document dual pane view.

The same document can also be opened in two windows.
Changes made in one view are immediately reflected in the other, while each view maintains its own cursor position and scroll position.

Use the following commands to navigate between panes.

| Command                   | Description                                   |
|:--------------------------|:----------------------------------------------|
| `toggle_split_editor`     | Show or hide the split editor.                |
| `focus_main_editor`       | Move keyboard focus to the main editor.       |
| `focus_split_editor`      | Move keyboard focus to the split editor.      |

All editor views support normal editing, syntax highlighting, selections, and navigation.

### Auto completion

Peeknext provides context-aware auto completion using text from the current document.

As you type, Peeknext suggests words, identifiers, and other text already present in the file.
Suggestions update as the document changes.

Auto completion does not require an AI model, language server, or internet connection.

**Project-wide auto completion is currently not supported.**
Suggestions are generated from the current document only.

#### Accepting suggestions

Auto completion suggestions can be accepted using a configurable editor command.

<pre class="editor-mockup language-hackerman-config"><code>
<span class="config-header-syntax">[editor]</span>

auto_complete                       <span class="config-string-syntax">true</span>
accept_auto_completion              <span class="comment-syntax">newline</span>
</code></pre>

With this configuration, <kbd>⏎<span>Return</span></kbd> accepts the selected suggestion when auto completion is active.
Otherwise, Return inserts a newline normally.

### Code completion

Peeknext supports optional AI-powered code completion through Ollama.

Unlike document-based auto completion, code completion uses a language model to suggest text based on the surrounding code.
Code completion is disabled until a model is configured.

#### Setting up Ollama

Install and configure [Ollama](https://ollama.com/), then download a compatible code completion model.
For example:
    
```
ollama pull qwen2.5-coder:1.5b
```

Configure the model in your Peeknext configuration file:
    
<pre class="editor-mockup language-hackerman-config"><code>
<span class="config-header-syntax">[models]</span>

code_completion                     <span class="comment-syntax">qwen2.5-coder:1.5b</span>
</code></pre>

Code completion works best with models that support fill-in-the-middle (FIM) generation.
Smaller models generally provide faster suggestions, particularly when running locally.

#### Accepting code completion

Code completion suggestions appear as ghost text in the editor.
Configure the command used to accept a suggestion:
    
<pre class="editor-mockup language-hackerman-config"><code>
<span class="config-header-syntax">[editor]</span>

accept_code_completion              <span class="comment-syntax">tab</span>
</code></pre>

When a suggestion is available, <kbd>⇥<span>Tab</span></kbd> accepts it.
Otherwise, Tab retains its normal editing behavior.

Auto completion and code completion have independent acceptance settings.

### Inline commands

Inline commands allow you to execute shell commands, evaluate Python expressions, and submit AI chat prompts directly from a document.
Invoke them with <kbd>⌘⇧⏎</kbd>, or <kbd><span>Inline command</span></kbd> through the Command Palette.

By default, inline commands are available in `txt`, `md`, and `org` files.
Additional file types can be configured through `inline_command_in_files`.

#### Shell commands

Prefix a command with `%` to execute it using the system shell.

<pre class="editor-mockup"><code>
<span class="inline-shell-syntax">% pwd</span>
</code></pre>

Place the cursor on the command line and invoke Inline command.

Shell commands have a hard execution timeout of 10 seconds.
They are intended for short commands and scripts rather than interactive programs or long-running processes.

The prefix can be changed using `inline_shell_symbol` in `[editor]`.

#### Python expressions

Python expressions can be evaluated directly without a prefix.

<pre class="editor-mockup"><code>
print("hello there")
</code></pre>

Place the cursor on the expression and invoke Inline command.

#### Inline chat

Inline chat allows you to submit prompts to an AI model without leaving the editor.
Configure a model in `[models]`:

<pre class="editor-mockup language-hackerman-config"><code>
<span class="config-header-syntax">[models]</span>

inline_chat                         <span class="comment-syntax">gpt-oss:120b-cloud</span>
</code></pre>

Prompts begin with the configured inline chat prefix, which defaults to `>`.

<pre class="editor-mockup"><code>
<span class="inline-chat-syntax">> Explain why this function may be slow.</span>
</code></pre>

Place the cursor on the prompt line and invoke Inline command.

Peeknext sends the current document as context and writes the model's response directly into the file.
The prefix can be changed using `inline_chat_symbol` in `[editor]`.

**Both inline chat and code completion are optional.**
Peeknext can operate entirely offline without either feature.

### Search and replace

Peeknext provides search within the current document and project-wide search across files.

#### Search within a document

Use <kbd>⌘F</kbd> or the Find in file command to search the current document.
Search operates on the active buffer without requiring a project or file index.

#### Project-wide search

Use <kbd>⌘⇧F</kbd> or the Show search explorer command to search across files in the current File Explorer root.
Project-wide search uses [ripgrep](https://ripgrep.dev/) and searches recursively through the selected directory.

Results update as you type, allowing you to locate text, identifiers, and references across multiple files.

The search scope follows the File Explorer root. To search a different directory, change the root before searching.

Files and directories excluded through `file_types_to_exclude` are omitted from the file index.

### Files and navigation

Peeknext uses a folder-based workflow without project files or project-specific configuration.
Any directory can serve as the working root for file navigation and project-wide search.

#### File Explorer

The File Explorer displays files and directories under the current root.

By default, the root is the Desktop.
You can change it using `file_explorer_root` in `[editor]` or navigate to another directory from the File Explorer.

Use <kbd><span>Reset file explorer</span></kbd> to return to the default location.

#### Startup files

Peeknext can automatically open specific files when it launches.
Configure `files_to_open_on_startup` in `[editor]` with a comma-separated list of absolute paths.

### File comparison

Peeknext provides commands for comparing files against Git and other open buffers.

| Command                   | Description                                   |
|:--------------------------|:----------------------------------------------|
| `open_diff_from_git`      | Compare the current file against its Git version. |
| `open_diff_from_buffers`  | Compare the contents of open buffers.         |
| `diff_open_buffers_word_indicators` | Display word-level difference indicators between open buffers. |

#### Git comparison

Use Open diff from Git to compare the current document with its Git version.
This is useful for reviewing local modifications without leaving the editor.

#### Buffer comparison

Use Open diff from buffers to compare documents already open in Peeknext.
Word-level difference indicators provide additional detail when examining changes within individual lines.

Diff colors are controlled by the active theme.

| Style         | Description       |
|:--------------|:------------------|
| `_error`      | Deleted lines.    |
| `_warning`    | Modified lines.   |
| `_success`    | Added lines.      |

See [Appearance](#appearance) for theme customization.

### Syntax highlighting

Peeknext includes built-in syntax highlighting for supported programming and markup languages.

The editor automatically selects a lexer based on the file type.
Lexers identify language elements such as keywords, strings, comments, operators, and function names.

Supported languages include:

- C and C++
- Python
- Rust
- HTML
- Markdown
- Bash
- Assembly
- Odin
- PHP

Additional lexers may be available depending on the installed version.

#### Lexer selection

Syntax highlighting is normally selected automatically when opening a file.
The following commands are available through the Command Palette.

| Command               | Description       |
|:----------------------|:------------------|
| `auto_detect_lexer`   | Automatically detect and apply a lexer to the current document. |
| `detach_lexer`        | Remove the active lexer and display the document without syntax highlighting. |

The active lexer can be displayed in the status bar using `show_active_lexer`.

#### Syntax colors

All built-in lexers use a shared set of theme styles, allowing the same theme to provide consistent highlighting across different languages.
Colors for keywords, strings, comments, types, functions, and other language elements are configured through the active theme.

See [Appearance](#appearance) for the complete syntax style reference.

### Line endings

Peeknext supports three line ending formats:
    
- `lf`, Unix/macOS line feed
- `crlf`, Windows carriage return and line feed
- `cr`, legacy Mac carriage return

The default line ending mode can be configured using `eol_mode`.

<pre class="editor-mockup language-hackerman-config"><code>
<span class="config-header-syntax">[editor]</span>

eol_mode                            <span class="config-string-syntax">lf</span> <span class="comment-syntax">-- crlf, cr, lf</span>
eol_symbols_visible                 <span class="config-number-syntax">false</span>
</code></pre>

#### Changing line endings

The line ending mode can also be changed for the current buffer using the Command Palette.
Peeknext provides separate commands to:

- Change the active EOL mode for subsequent editing.
- Convert all existing line endings in the document to the selected format.

Changing the active mode does not necessarily convert existing line endings.
Use the conversion command when you want to normalize an entire file.

Line ending symbols can be displayed using `eol_symbols_visible` in the configuration.

## Editor commands

Peeknext provides editor commands for file management, navigation, text editing, selections, multi-cursor editing, and workspace control.
Commands can be executed through the Command Palette or assigned keyboard shortcuts.

### Files and windows

| Command                       | Description |
|:------------------------------|:------------|
| `new_file`                    | Create a new empty document. |
| `new_window`                  | Open a new editor window. |
| `open_file`                   | Open a file from disk. |
| `save_file`                   | Save the current document. |
| `save_file_as`                | Save the current document under a new name or location. |
| `save_file_copy_as`           | Save a copy of the current document without changing the original file. |
| `close_file`                  | Close the current document. |
| `close_window`                | Close the current editor window. |
| `close_other_files`           | Close all files except the current document. |
| `reopen_last_closed_file`     | Reopen the most recently closed file. |
| `reload_from_disk`            | Reload the current document from disk. |
| `open_file_in_new_window`     | Open the current file in a new editor window. |
| `copy_path_to_file`           | Copy the current file's absolute path to the clipboard. |
| `reveal_in_finder`            | Reveal the current file in Finder. |
| `toggle_read_only`            | Toggle read-only mode for the current document. |

### Workspace and interface

| Command                       | Description |
|:------------------------------|:------------|
| `toggle_split_editor`         | Show or hide the split editor view. |
| `focus_main_editor`           | Move keyboard focus to the main editor. |
| `focus_split_editor`          | Move keyboard focus to the split editor. |
| `show_file_explorer`          | Open the File Explorer. |
| `show_buffer_explorer`        | Open the Buffer Explorer. |
| `show_outline_panel`          | Open the document outline panel. |
| `show_command_palette`        | Open the Command Palette. |
| `show_search_explorer`        | Open project-wide search. |
| `open_terminal`               | Open an external terminal. |
| `open_config_file`            | Open the Peeknext configuration file. |
| `open_scripts_file`           | Open the user scripts file. |
| `reset_window_position`       | Reset the editor window position. |
| `reset_file_explorer`         | Reset the File Explorer to its default root. |
| `reload_file_explorer`        | Refresh the File Explorer contents. |
| `show_license_info`           | Display license information. |

### Tabs and buffers

| Command                       | Description |
|:------------------------------|:------------|
| `previous_tab`                | Switch to the previous tab. |
| `previous_tab_extend`         | Switch to the previous tab while extending the tab selection. |
| `next_tab`                    | Switch to the next tab. |
| `next_tab_extend`             | Switch to the next tab while extending the tab selection. |
| `unselect_other_active_tabs`  | Deselect all other selected tabs. |
| `switch_to_buffer_1` - `switch_to_buffer_9` | Switch to the corresponding buffer position. |
| `extend_to_buffer_1` - `extend_to_buffer_9` | Extend the active tab selection to the corresponding buffer position. |

### Basic editing

| Command                       | Description |
|:------------------------------|:------------|
| `undo`                        | Undo the last editing operation. |
| `redo`                        | Redo the last undone operation. |
| `copy`                        | Copy the selected text. |
| `cut`                         | Cut the selected text. |
| `paste`                       | Paste text from the clipboard. |
| `select_all`                  | Select the entire document. |
| `cancel`                      | Cancel the current operation or selection. |
| `newline`                     | Insert a new line. |
| `tab`                         | Insert a tab or indentation. |
| `backtab`                     | Reduce indentation. |
| `line_indent`                 | Increase indentation of the current line or selection. |
| `line_unindent`               | Decrease indentation of the current line or selection. |
| `line_comment`                | Toggle line comments for the current line or selection. |
| `lowercase`                   | Convert selected text to lowercase. |
| `uppercase`                   | Convert selected text to uppercase. |
| `duplicate_line`              | Duplicate the current line. |
| `selection_duplicate`         | Duplicate the current selection. |
| `move_line_up`                | Move the current line or selected lines upward. |
| `move_line_down`              | Move the current line or selected lines downward. |
| `insert_line_above`           | Insert a new line above the current line. |
| `insert_line_below`           | Insert a new line below the current line. |
| `delete_line`                 | Delete the current line. |
| `sort_selected_lines`         | Sort selected lines in ascending order. |
| `sort_selected_lines_reverse` | Sort selected lines in descending order. |
| `format_csv_columns`          | Align comma-separated values into columns. |

### Selections and multiple cursors

| Command                       | Description |
|:------------------------------|:------------|
| `select_next_match`           | Add the next occurrence of the selected text to the selection. |
| `unselect_last_match`         | Remove the most recently added matching selection. |
| `select_matches`              | Select all matching occurrences of the current selection. |
| `add_cursors_to_line_starts`  | Add cursors at the beginning of selected lines. |
| `line_add_caret_up`           | Add a cursor on the line above. |
| `line_add_caret_down`         | Add a cursor on the line below. |

### Cursor movement

| Command                       | Description |
|:------------------------------|:------------|
| `move_caret_back`             | Move the cursor one character backward. |
| `move_caret_forward`          | Move the cursor one character forward. |
| `line_up`                     | Move the cursor up one line. |
| `line_down`                   | Move the cursor down one line. |
| `home`                        | Move the cursor to the beginning of the line. |
| `move_caret_line_start`       | Move the cursor to the start of the current line. |
| `move_caret_line_end`         | Move the cursor to the end of the current line. |
| `document_start`              | Move the cursor to the beginning of the document. |
| `document_end`                | Move the cursor to the end of the document. |
| `move_caret_back_word`        | Move backward to the beginning of a word. |
| `move_caret_forward_word`     | Move forward to the beginning of the next word. |
| `move_caret_back_word_end`    | Move backward to a word boundary. |
| `move_caret_forward_word_end` | Move forward to the end of a word. |
| `move_caret_back_word_part`   | Move backward to the previous word-part boundary. |
| `move_caret_forward_word_part`| Move forward to the next word-part boundary. |
| `move_caret_paragraph_above`  | Move to the previous paragraph. |
| `move_caret_paragraph_below`  | Move to the next paragraph. |
| `move_up_to_empty_line`       | Move to the previous empty line. |
| `move_down_to_empty_line`     | Move to the next empty line. |
| `line_up_start`               | Move to the beginning of the line above. |
| `line_down_end`               | Move to the end of the line below. |
| `go_to_line`                  | Navigate to a specified line number. |
| `center_on_cursor`            | Center the editor view on the current cursor position. |

### Extending selections

Commands ending in `_extend` move the cursor while extending the current selection.

| Command                       | Description |
|:------------------------------|:------------|
| `extend_selection_back`       | Extend the selection one character backward. |
| `extend_selection_forward`    | Extend the selection one character forward. |
| `line_up_extend`              | Extend the selection one line upward. |
| `line_down_extend`            | Extend the selection one line downward. |
| `home_extend`                 | Extend the selection to the beginning of the line. |
| `extend_selection_line_start` | Extend the selection to the start of the current line. |
| `extend_selection_line_end`   | Extend the selection to the end of the current line. |
| `document_start_extend`       | Extend the selection to the beginning of the document. |
| `document_end_extend`         | Extend the selection to the end of the document. |
| `extend_selection_back_word`  | Extend the selection backward by one word. |
| `extend_selection_forward_word` | Extend the selection forward by one word. |
| `extend_selection_back_word_end` | Extend the selection backward to a word boundary. |
| `extend_selection_forward_word_end` | Extend the selection forward to the end of a word. |
| `extend_selection_back_word_part` | Extend the selection backward by one word part. |
| `extend_selection_forward_word_part` | Extend the selection forward by one word part. |
| `extend_selection_paragraph_above` | Extend the selection to the previous paragraph. |
| `extend_selection_paragraph_below` | Extend the selection to the next paragraph. |
| `move_up_to_empty_line_extend` | Extend the selection to the previous empty line. |
| `move_down_to_empty_line_extend` | Extend the selection to the next empty line. |
| `line_up_start_extend`        | Extend the selection to the beginning of the line above. |
| `line_down_end_extend`        | Extend the selection to the end of the line below. |

### Scrolling and display

| Command                       | Description |
|:------------------------------|:------------|
| `line_scroll_up`              | Scroll the editor upward by one line. |
| `line_scroll_down`            | Scroll the editor downward by one line. |
| `page_up`                     | Move upward by one page. |
| `page_down`                   | Move downward by one page. |
| `page_up_stuttered`           | Scroll upward using stuttered page movement. |
| `page_down_stuttered`         | Scroll downward using stuttered page movement. |
| `zoom_in`                     | Increase the editor font size. |
| `zoom_out`                    | Decrease the editor font size. |
| `reset_zoom`                  | Restore the default editor zoom level. |
| `toggle_word_wrap`            | Toggle line wrapping. |
| `toggle_indent_guides`        | Show or hide indentation guides. |

### Deleting text

| Command                       | Description |
|:------------------------------|:------------|
| `delete_back`                 | Delete the character before the cursor. |
| `delete_back_not_newline`     | Delete backward without joining lines. |
| `delete_forward`              | Delete the character after the cursor. |
| `delete_back_word`            | Delete the word before the cursor. |
| `delete_forward_word`         | Delete the word after the cursor. |
| `delete_to_line_start`        | Delete text from the cursor to the beginning of the line. |
| `delete_to_line_end`          | Delete text from the cursor to the end of the line. |

### Search and comparison

| Command                       | Description |
|:------------------------------|:------------|
| `find_in_file`                | Search for text within the current document. |
| `open_diff_from_git`          | Open a comparison against the Git version of the file. |
| `open_diff_from_buffers`      | Open a comparison between buffers. |
| `diff_open_buffers_word_indicators` | Display word-level differences between open buffers. |

### Folding

| Command                       | Description |
|:------------------------------|:------------|
| `fold_line`                   | Toggle folding at the current line. |
| `fold_all`                    | Fold or unfold all available regions. |
| `move_caret_to_fold_above`    | Move the cursor to the previous fold point. |
| `move_caret_to_fold_below`    | Move the cursor to the next fold point. |
| `extend_selection_to_fold_above` | Extend the selection to the previous fold point. |
| `extend_selection_to_fold_below` | Extend the selection to the next fold point. |

### Indentation and line endings

| Command                       | Description |
|:------------------------------|:------------|
| `detect_tab_width`            | Detect indentation width from the current document. |
| `tab_width_2_spaces`          | Set the tab width to two spaces. |
| `tab_width_4_spaces`          | Set the tab width to four spaces. |
| `tab_width_8_spaces`          | Set the tab width to eight spaces. |
| `indent_with_spaces`          | Use spaces for indentation. |
| `indent_with_tabs`            | Use tab characters for indentation. |
| `eol_mode_lf`                 | Set the line ending mode to LF. |
| `eol_mode_crlf`               | Set the line ending mode to CRLF. |
| `eol_mode_cr`                 | Set the line ending mode to CR. |
| `replace_all_eol`             | Convert all line endings to the active EOL mode. |
| `toggle_eol_symbols`          | Show or hide line ending symbols. |
| `replace_tabs_with_spaces`    | Replace tab characters with spaces. |

### Syntax highlighting

| Command                       | Description |
|:------------------------------|:------------|
| `detach_lexer`                | Remove syntax highlighting from the current document. |
| `auto_detect_lexer`           | Automatically detect and apply a syntax highlighter. |

### Inline commands and AI

| Command                       | Description |
|:------------------------------|:------------|
| `inline_command`              | Execute an inline shell command, evaluate an expression, or submit an inline chat prompt. |
| `python_eval_line`            | Evaluate Python code on the current line. **REMOVED** |
| `submit_prompt`               | Submit a prompt to the configured AI model. **REMOVED** |

## Appearance

Peeknext includes built-in color themes and supports custom themes defined directly in the configuration file.
Themes control editor colors, syntax highlighting, selections, and interface appearance.

### Built-in themes

The following themes are included with Peeknext:

```
koi             koi-dark        koi-mono
hackerman       focus           writer
github-dark     kujukuju        ayu-dark
chatgpt         dracula         gruvbox
jblow           mono-light      tokyo-night
catppuccin      nord            monokai
```

Select a theme using the `theme` setting in `[editor]`.

<pre class="editor-mockup language-hackerman-config"><code>
<span class="config-header-syntax">[editor]</span>

theme                               <span class="config-string-syntax">koi-dark</span>
</code></pre>

To automatically switch themes based on the macOS appearance, use `adaptive`.

<pre class="editor-mockup language-hackerman-config"><code>
<span class="config-header-syntax">[editor]</span>

theme                               <span class="config-string-syntax">adaptive</span>
adaptive_theme                      <span class="config-string-syntax">koi, koi-dark</span>
</code></pre>

The first theme is used in light mode and the second in dark mode.

### Custom themes

Themes are defined as named sections in the configuration file.
You can create a custom theme by adding a section with your preferred name and defining its colors.

For example:

<pre class="editor-mockup language-hackerman-config"><code>
<span class="config-header-syntax">[my-theme]</span>

background                          <span class="comment-syntax">#1f272a</span>
foreground                          <span class="comment-syntax">#f7f7f4</span>
text_color                          <span class="comment-syntax">#ffffff</span>
cursor                              <span class="comment-syntax">#C6E5FF</span>

default                             <span class="comment-syntax">#f7f7f4</span>
keyword                             <span class="comment-syntax">#E67D74</span>
class                               <span class="comment-syntax">#D0C5A9</span>
name                                <span class="comment-syntax">#D0C5A9</span>
function                            <span class="comment-syntax">#D0C5A9</span>
string                              <span class="comment-syntax">#D4BC7D</span>
number                              <span class="comment-syntax">#D699B5</span>
operator                            <span class="comment-syntax">#E0AD82</span>
comment                             <span class="comment-syntax">#87919D</span>
special                             <span class="comment-syntax">#C6E5FF</span>
type                                <span class="comment-syntax">#C6E5FF</span>
constant                            <span class="comment-syntax">#D699B5</span>
builtin                             <span class="comment-syntax">#E0AD82</span>

_highlight                          <span class="comment-syntax">#D4BC7D</span>
_link                               <span class="comment-syntax">#C6E5FF, #C6E5FF</span>
</code></pre>

Activate the theme by setting:

<pre class="editor-mockup language-hackerman-config"><code>
<span class="config-header-syntax">[editor]</span>

theme                               <span class="config-string-syntax">my-theme</span>
</code></pre>

Each theme maps colors to a shared set of syntax styles.
Peeknext lexers use these styles to provide consistent syntax highlighting across supported languages.

### Theme styles

#### Interface colors

Four base colors control the editor's appearance.

| Style             | Description |
|:------------------|:------------|
| `background`      | Editor background color. |
| `foreground`      | Interface foreground color. |
| `text_color`      | Text color for highlighted or selected interface elements. |
| `cursor`          | Text cursor color. |

Other interface colors, including dialog backgrounds, selections, and active states, are derived automatically from these values.

#### Syntax colors

Syntax styles determine how different elements of source code are highlighted.

| Style             | Description |
|:------------------|:------------|
| `default`         | Default text color. |
| `keyword`         | Language keywords. |
| `class`           | Class names. |
| `name`            | Names and identifiers, including function names. |
| `function`        | Function definitions. |
| `string`          | String literals. |
| `number`          | Numeric literals. |
| `operator`        | Operators. |
| `comment`         | Comments. |
| `special`         | Language-specific symbols and special syntax. |
| `type`            | Type names. |
| `constant`        | Constants. |
| `builtin`         | Built-in functions and identifiers. |

The exact styles used depend on the active lexer.

#### Optional styles

Optional styles provide additional control over selections, search results, rich-text syntax, annotations, and diff indicators.
When omitted, these styles use default colors or fall back to another defined style.

| Style             | Description |
|:------------------|:------------|
| `_selection`      | Text selection color. |
| `_highlight`      | Match text highlights. |
| `_link`           | Links in Markdown and Org. Falls back to `special`. |
| `_bold`           | Bold rich-text syntax. Falls back to `builtin`. |
| `_italic`         | Italic rich-text syntax. Falls back to `name`. |
| `_underline`      | Underlined rich-text syntax. Falls back to `default`. |
| `_verbatim`       | Verbatim rich-text syntax. Falls back to `name`. |
| `_code`           | Inline code in Markdown and Org. Falls back to `comment`. |
| `_annotation`     | Editor annotations. Falls back to `comment`. |
| `_error`          | Deleted diff lines. |
| `_warning`        | Warnings, status indicators, and modified diff lines. |
| `_success`        | Added diff lines. |

### Style formatting

Styles support foreground colors, optional background colors, and text formatting.

#### Foreground color

Specify a hexadecimal color to set the text color.

<pre class="editor-mockup language-hackerman-config"><code>
keyword                             <span class="comment-syntax">#FF79C6</span>
</code></pre>

#### Foreground and background

Add a second hexadecimal color to specify the background.

<pre class="editor-mockup language-hackerman-config"><code>
_link                               <span class="comment-syntax">#0081FF, #0081FF</span>
</code></pre>

Peeknext automatically applies opacity to style backgrounds, allowing the foreground and background to use the same color without obscuring the text.

#### Text formatting

Add `bold` or `italic` to change the text appearance.

<pre class="editor-mockup language-hackerman-config"><code>
keyword                             <span class="comment-syntax">#FF79C6, bold</span>
</code></pre>

Foreground color, background color, and formatting can also be combined.

<pre class="editor-mockup language-hackerman-config"><code>
keyword                             <span class="comment-syntax">#FF79C6, #282A36, italic</span>
</code></pre>

Currently supported text formats are `bold` and `italic`.

