docs/plugins/index.md
Fresh's functionality can be extended with packages:
Bundled plugins:
TODO, FIXME, and other keywords in your comments.Run and hot-reload plugins directly from an open .ts buffer using "Load Plugin from Buffer" from the command palette. The buffer gets LSP support for the Fresh plugin API, making this useful for rapid plugin development.
registerHandler()Plugins should use registerHandler() to register command handlers instead of the older globalThis pattern. This provides better type safety and is the recommended approach for all new plugins.
On macOS, plugins folder needs to live either in the same directory as the binary OR in the directory that fresh is run from. If installed via homebrew, the binary lives in
/opt/homebrew/bin/fresh. The simplest, cleanest way to to create a symbolic link in that folder pointing to your plugins. i.e.ln -s /Users/username/freshplugins /opt/homebrew/bin/plugins
Fresh includes a built-in package manager.
Use the command palette (Ctrl+P >) and search for:
| Command | Description |
|---|---|
pkg: Install Plugin | Browse and install plugins from the registry |
pkg: Install Theme | Browse and install themes from the registry |
pkg: Install from URL | Install directly from any git repository URL |
pkg: List Installed | Show all installed packages |
pkg: Update All | Update all installed packages |
pkg: Remove Package | Remove an installed package |
Any git repository can be installed directly:
Ctrl+P)pkg: Install from URLhttps://github.com/user/fresh-plugin)Monorepo support: For repositories containing multiple plugins, use a URL fragment to specify the subdirectory:
https://github.com/user/fresh-plugins#packages/rainbow-brackets
This installs only the packages/rainbow-brackets directory from the repository.
Installed packages are stored in:
~/.config/fresh/plugins/packages/~/.config/fresh/themes/packages/~/.config/fresh/grammars/Each package is a git repository, so you can update manually with git pull if needed.
By default, Fresh uses the official package registry. You can add additional registries in your config:
{
"packages": {
"sources": [
"https://github.com/sinelaw/fresh-plugins-registry",
"https://github.com/my-org/private-plugins"
]
}
}
Run pkg: Sync Registry to fetch the latest package lists.
Use the CLI to scaffold new packages:
fresh --init # Interactive mode
fresh --init plugin # Create a plugin
fresh --init theme # Create a theme
fresh --init language # Create a language pack
For detailed guides, see:
Bundles combine multiple languages and plugins into a single installable package. Useful for language ecosystems with multiple file types (e.g., Elixir + HEEx templates).
{
"name": "elixir-bundle",
"type": "bundle",
"fresh": {
"languages": [
{
"id": "elixir",
"grammar": { "file": "grammars/elixir.sublime-syntax", "extensions": ["ex", "exs"] },
"language": { "commentPrefix": "#" },
"lsp": { "command": "elixir-ls" }
},
{
"id": "heex",
"grammar": { "file": "grammars/heex.sublime-syntax", "extensions": ["heex"] }
}
],
"plugins": [
{ "id": "elixir-tools", "entry": "plugins/tools.ts" }
]
}
}
Bundles are shown with a "B" tag in the package manager. Create one with fresh --init bundle.
Fresh ships plugins/clangd_support.ts with the source tree; see plugins/clangd_support.md for an overview of the plugin commands and how it surfaces clangd-specific notifications in the status bar.