# Emacs

`oxyaml` is a drop-in replacement for `yaml-language-server`. Point Eglot or `lsp-mode` at `oxyaml --stdio` and existing `yaml.*` settings keep working unchanged without Node.js.

> **Status:** Emacs Lisp snippets below are **untested** with `emacs --batch` in this environment (`emacs` is not installed locally).

## Prerequisites

[Install oxyaml](../../README.md#installation) and make sure `oxyaml` is on your `PATH`.

## Eglot (built-in in Emacs 29+)

Add to your `init.el` (replaces `("yaml-language-server" "--stdio")` in `eglot-server-programs`):

```elisp
(with-eval-after-load 'eglot
  (add-to-list 'eglot-server-programs
               '((yaml-ts-mode yaml-mode) . ("oxyaml" "--stdio"))))
```

Existing `eglot-workspace-configuration` (`:yaml ...`) settings continue to work unchanged.

## lsp-mode

In your `init.el`, set `lsp-yaml-server-command` (one-line change from `'("yaml-language-server" "--stdio")`):

```elisp
(setq lsp-yaml-server-command '("oxyaml" "--stdio"))
```

All existing `lsp-yaml-*` customization variables (`lsp-yaml-schemas`, `lsp-yaml-format-enable`, `lsp-yaml-custom-tags`, etc.) continue to work unchanged.
