Skip to main content
Fresh’s functionality can be extended with a powerful plugin system. Plugins are written in TypeScript and run in a sandboxed QuickJS environment (transpiled via oxc_transformer), providing full access to the editor’s API while maintaining security and performance.

What are Plugins?

Plugins are TypeScript files that extend the editor’s functionality by:
  • Registering custom commands and keybindings
  • Creating interactive panels and virtual buffers
  • Running external processes and tools
  • Integrating with LSP servers
  • Adding visual decorations and overlays
  • Responding to editor events

Plugin Architecture

TypeScript Runtime

Plugins are written in TypeScript and automatically transpiled to JavaScript using the blazing-fast oxc_transformer.

Sandboxed QuickJS

All plugins run in an isolated QuickJS environment, providing security and preventing plugins from interfering with each other.

Editor API

Access a comprehensive TypeScript API through the global editor object for all editor operations.

Async/Await Support

Native support for async/await allows plugins to spawn processes, make LSP requests, and perform I/O without blocking.

Available Plugins

Fresh ships with a rich collection of production-ready plugins:

Core Plugins

Git Integration

Powerful Git workflow integration:

Code Enhancement

Language Support

Built-in LSP integration for multiple languages:

TypeScript/JavaScript

typescript-lsp.ts

Rust

rust-lsp.ts

Python

python-lsp.ts

Go

go-lsp.ts

C/C++

clangd-lsp.ts

Java

java-lsp.ts
And many more: css-lsp.ts, html-lsp.ts, json-lsp.ts, latex-lsp.ts, marksman-lsp.ts, zig-lsp.ts, odin-lsp.ts, templ-lsp.ts

Editing Modes

Advanced Features

Plugin Lifecycle

Plugins are loaded automatically when Fresh starts:
1

Discovery

All .ts files in the plugins/ directory are discovered at startup.
2

Transpilation

Each plugin is transpiled from TypeScript to JavaScript using oxc_transformer.
3

Execution

The transpiled JavaScript runs in a sandboxed QuickJS runtime with access to the editor API.
4

Registration

Plugins register commands, event handlers, and modes during initialization.
There is no explicit activation step. All plugins in the plugins/ directory are loaded automatically.

Core Concepts

The editor Object

The global editor object is the main entry point for the Fresh plugin API:
The editor object provides methods for:
  • Commands: Register custom actions in the command palette
  • Buffers: Read and modify text content
  • Overlays: Add visual decorations without changing content
  • Processes: Spawn external commands and tools
  • Events: Subscribe to editor state changes
  • LSP: Communicate with language servers
  • File System: Read/write files and directories

Commands

Commands are actions that appear in the command palette and can be bound to keys:

Virtual Buffers

Create special buffers for displaying structured data like search results or diagnostics:

Event Handlers

Subscribe to editor events to react to user actions:
Available Events:
  • buffer_save - After a buffer is saved
  • buffer_closed - When a buffer is closed
  • cursor_moved - When cursor position changes
  • render_start - Before screen renders
  • lines_changed - When visible lines change

Package Types

Fresh supports multiple package types:

Plugins

TypeScript code that extends editor functionality

Themes

Color schemes for syntax highlighting and UI

Language Packs

Syntax highlighting, language config, and LSP support

Bundles

Bundles combine multiple languages and plugins into a single package. Useful for language ecosystems with multiple file types:

Next Steps

Getting Started

Learn how to install and use plugins

Plugin Development

Create your own plugins with TypeScript

Plugin Examples

Explore real plugin examples with code

API Reference

Complete API documentation