-
Notifications
You must be signed in to change notification settings - Fork 1
REPL
The REPL in swank.nvim is a read-only output buffer that displays all output
from the Swank server: evaluation results, format t output, warnings, and
interactive prompts.
The REPL window opens automatically whenever new output arrives from the server. You can also toggle it manually:
<Leader>rw
Three layouts are available: vertical split (right), horizontal split (bottom), and floating window.
The plugin picks the best layout based on your terminal dimensions:
- Vertical split (right) — if the configured size gives the REPL at least 80 columns. At the default 45%, this requires ~178 terminal columns.
- Horizontal split (bottom) — if the vertical split would be too narrow but a horizontal split gives at least 12 rows.
- Float — if the terminal is too small for either split.
require("swank").setup({
ui = {
repl = {
position = "right", -- always vertical split
-- position = "bottom", -- always horizontal split
-- position = "float", -- always floating
size = 0.45,
}
}
})size controls the width (for "right") or height (for "bottom") of the
REPL window.
| Value | Meaning |
|---|---|
0.45 |
45% of the relevant editor dimension (default) |
0.33 |
33% (one-third) |
0.25 |
25% |
80 |
exactly 80 columns or rows |
<Leader>lp
Prompts for a package name and tells the Swank server to switch the active evaluation context to that package. This is a connection-level setting and is available from any Lisp buffer, not just the REPL.
The REPL buffer shows output from multiple Swank event types:
| Swank event | What you see |
|---|---|
:write-string |
Raw output from (format t ...), (print ...), etc. |
:presentation-start / :presentation-end
|
Result presentations from eval |
:read-string |
Interactive read prompt (e.g. (read)) |
:debug-activate |
Debugger entered — shown inline before SLDB window |
The REPL buffer (swank://repl) is normally read-only. To send an expression
to the server, use <Leader>ei (interactive eval with prompt) or the eval
keymaps from a Lisp source buffer.
Check that require("swank").attach(bufnr) is being called for your Lisp buffers.
The auto-open is triggered from ui/repl.lua:M.append(), which is only called
if the client is wired up.
Explicitly set position to "right", "bottom", or "float" in your config
to bypass the auto-detection logic.
swank.nvim silently discards stderr from the sbcl process during normal startup. The Swank contrib compilation STYLE-WARNINGs you see in a terminal are suppressed. Stderr is only surfaced as a notification if sbcl exits with a non-zero exit code.