clank.nvim wires AI coding "harnesses" (Claude Code, with more planned) into
Neovim through a small provider abstraction, so you can send a visual
selection to the model and have the result applied directly to your buffer
(reversible with normal u undo).
- Neovim >= 0.10
- The
claudeCLI on your$PATH(for the defaultclaudeharness)
With vim.pack (Neovim >= 0.12):
vim.pack.add({
"https://github.com/bxrne/clank.nvim",
})
require("clank").setup()With lazy.nvim:
{
"bxrne/clank.nvim",
opts = {},
}require("clank").setup({
harness = "claude", -- which provider to dispatch to
model = "sonnet-4.6",
keymaps = {
fill = "<leader>af", -- visual-mode keymap, set to false to disable
},
})Send the current visual selection to the configured harness, asking it to
fill in / complete the selected code, and replace the selection with the
response. Also bound to the keymaps.fill keymap (default <leader>af) in
visual mode.
Usage: select a block (e.g. an empty function body) in visual mode, then
press <leader>af (or run :ClankFill).
Send a git diff to the configured harness for review and load its comments
into the quickfix list. Requires git to be on $PATH and the current
working directory to be inside a git repository.
The required integer argument selects what to review:
0— uncommitted changes (staged and unstaged)1— the most recent commit2— the commit before that- ...and so on
The harness is asked to respond with one path:line: message line per
issue, which is parsed straight into the quickfix list (:copen to view).
Usage: :ClankReview 0 to review your working tree changes, :ClankReview 1
to review the last commit, etc.
Send the buffers referenced by the quickfix list to the configured harness, asking it to fix the listed issues, and replace each buffer's contents with the response.
Run :ClankFix with no range to fix every entry in the quickfix list.
Alternatively, from the quickfix window (:copen), select a range of lines
in visual mode and run :'<,'>ClankFix to fix only those entries.
| Option | Type | Default | Description |
|---|---|---|---|
harness |
string |
"claude" |
Provider used to handle requests |
model |
string |
"sonnet-4.6" |
Model passed to the harness |
keymaps.fill |
string|false |
"<leader>af" |
Visual-mode keymap for :ClankFill, false to disable |
Providers are registered against lua/clank/provider/init.lua's registry and
implement a send(opts, callbacks) contract:
-- opts: { prompt, system?, session_id?, cwd }
-- callbacks: { on_chunk(text), on_done(result), on_error(err) }
-- returns a handle with handle.cancel()The built-in claude provider shells out to the claude CLI in headless
mode (claude -p ... --output-format text). Additional harnesses (Codex,
opencode, etc.) can be added by implementing the same contract and
registering under a new name.
make testTests run via plenary.nvim +
busted. The claude provider's tests stub vim.system, so no real CLI
invocation or network access is required.