A simple nREPL bridge for Zed editor that enables Clojure REPL integration without plugins.
Status: proof-of-concept
zed-nrepl provides an HTTP bridge between Zed editor and nREPL, allowing you to evaluate Clojure code directly from Zed using simple tasks.
This approach lets you enjoy REPL-driven development without the need for a complex plugin system (but we wait for it).
Include zed-nrepl in your project's deps.edn file:
{:aliases
{:zed-repl
{:extra-deps {io.github.ryukzak/zed-nrepl
{:git/url "https://github.com/ryukzak/zed-nrepl.git"
:git/sha "___________________________________"}}
:main-opts ["-m" "zed-nrepl.core"]}}}Run this command in your project directory:
clojure -M:zed-replThis will:
- Configure Zed by adding tasks to
.zed/tasks.json(existing files are automatically backed up) - Start an nREPL server connected to your project
- Create the HTTP bridge server on port 3000
Now you can evaluate Clojure code:
- Open any Clojure file in your project
- Select the code you want to evaluate
- Press
Cmd+Shift+R(orCtrl+Shift+Ron Windows/Linux) and selectEval selected code (zed-repl) - View results in the panel that appears
Add this to your Zed key bindings configuration for a more efficient workflow:
[
{
"context": "Workspace",
"bindings": {
"alt-7": ["task::Spawn", { "task_name": "Eval selected code (zed-repl)" }],
"alt-*": ["task::Spawn", { "task_name": "Eval code at point (zed-repl)" }],
"alt-8": ["workspace::SendKeystrokes", "cmd-s alt-*"],
"alt-(": ["task::Spawn", { "task_name": "Eval file (zed-repl)" }],
"alt-9": ["workspace::SendKeystrokes", "cmd-s alt-("],
"alt-)": ["task::Spawn", { "task_name": "Run tests (zed-repl)" }],
"alt-0": ["workspace::SendKeystrokes", "cmd-s alt-)"]
}
}
]BSD 2-Clause License. See LICENSE for details.
Contributions are welcome! Please feel free to submit a Pull Request or open an issue to discuss improvements.
- Evaluate current file
- Evaluate current top-level expression.
- Evaluate current/previous symbol/sexpr...