# Plugins

Plugins add commands, viewers, formats, tools, and other behavior to *Lx*.

## Built-in plugins

Built-in plugins live in:

```text
data/plugins
```

*Lx* loads them during startup. A plugin may be one Lua file or a folder with its own matching entry file.

Examples include Markdown preview, ANSI art preview, font preview, Office extraction, search tools, and editing helpers.

## Plugin settings

Some plugins provide settings under `config.plugins`.

For example:

```lua
local config = require("core.config")

config.plugins.lua_pad.timeout_seconds = 2
```

The exact names depend on the plugin. Read the plugin's entry file or supplied guide before adding a setting.

## Plugin commands

Plugins can add commands to the command palette.

Press **Ctrl+Shift+P** and search by a useful word such as `markdown`, `ansi`, `search`, or the plugin name.

Plugins may also add their own shortcuts. Your user shortcuts can replace those bindings.

## Friendly developer details

A plugin can add a short explanation to the Log View when developer details are on:

```lua
local dev_details = require("core.dev.details")

dev_details.report("My plugin", {
	"Input:",
	"example.txt",
	"Result:",
	"accepted",
})
```

Headings end in a colon. *Lx* places `- ` before every other line, so the values are easy to follow. The report does nothing unless `config.dev.show_details` is `true` or `dev:toggle-details` has turned it on for the session. Keep each report short and use plain labels instead of raw internal values.

## Windows Explorer integration

On Windows, the `windowsexplorer` plugin can make *Lx* available through Windows Explorer.

Run `windows-explorer:install` to open the normal Registry Editor confirmation. Run `windows-explorer:uninstall` to remove the integration the same way. These commands use temporary registry files and delete them after Registry Editor closes.

Run `windows-explorer:generate-reg-files` if you want reusable files instead. It creates `lx-explorer-install.reg` and `lx-explorer-uninstall.reg` beside *Lx* without importing them.

## Adding a plugin

In a local-data build, place a compatible plugin in `data/plugins`, then restart *Lx*.

Packaged builds load the plugins included when the package was made. Adding a loose file may not change that list.

Keep a separate copy. An application update may replace files inside `data`.

Only install plugins you trust. Plugins run inside *Lx* and can read or change files with the same access as *Lx*.

## Enabling and disabling

*Lx* does not currently have one general enabled/disabled plugin list.

Packaged builds decide which built-in plugins are included. In a local-data build, removing a plugin entry from `data/plugins` prevents discovery, but updates may restore it.

## When a plugin fails

*Lx* records the error and continues loading the remaining plugins.

Press **F12** to open the log, or run `log:open-last-error` from the command palette.

See [Troubleshooting](troubleshooting.md) for a short diagnostic checklist.
