An inline AI code assistant for Neovim, powered by the Claude CLI. Select code, ask a question, get a streaming response in a floating overlay — then apply it directly to your buffer.
- Neovim >= 0.9
- Claude CLI installed and authenticated (
claudein your PATH)
{
"your-username/nvim-ask",
config = function()
require("nvim-ask").setup()
end,
}{
dir = "~/path/to/nvim-ask",
config = function()
require("nvim-ask").setup()
end,
}require("nvim-ask").setup({
keybind = "<leader>ai", -- keybind for visual + normal mode
window = {
width = 0.8, -- fraction of editor width
height = 0.8, -- fraction of editor height
border = "rounded", -- border style
min_width = 40, -- minimum terminal width to open
min_height = 15, -- minimum terminal height to open
},
claude = {
model = nil, -- override model (e.g. "sonnet")
max_tokens = nil, -- max output tokens
timeout = 120, -- request timeout in seconds
},
})- Visually select code (
V,v, or<C-v>) - Press
<leader>ai(or your configured keybind) - Type your instruction in the prompt (e.g. "refactor this to use async/await")
- Press
<CR>to send - Press
<CR>in the response to replace the original selection
- Press
<leader>aiin normal mode - Type a general question
- Press
<CR>to send
You can also use the :NvimAsk command directly.
| Key | Context | Action |
|---|---|---|
<CR> |
Prompt buffer | Send request |
<CR> |
Response buffer | Apply code to original buffer |
y |
Response buffer | Yank response to clipboard |
r |
Response buffer | Retry (re-send same prompt) |
<Tab> |
Any | Cycle focus to next section |
<S-Tab> |
Any | Cycle focus to previous section |
q |
Any | Close the overlay |
- Invokes
claudeas a child process viavim.fn.jobstart - Streams the response token-by-token using
--output-format stream-json - Parses markdown code fences from the response for syntax highlighting and apply/yank
- Disables all Claude tools (
--tools "") so you only get text responses
MIT