Neovim plugin that integrates the Kilo TUI into your editor: a toggleable terminal split plus one-keystroke file mentions that attach context straight to the prompt.
kilo.nvim does few things but it does them well. It only takes care of the
communication between Neovim and Kilo. It doesn't try to reinvent the wheel
by re-implementing Kilo features within Neovim or vice-versa.
- Toggle a terminal split running
kiloin your current working directory - Move the split between the bottom and the right side, and then back
- Send the current line or a visual selection to Kilo as a file mention
- Implements the editor-integration protocol
- Hardened against real-world terminal edge cases
- A real
:checkhealth kiloprovider :KiloToggle,:KiloToggleSideand:[range]KiloSendfor command-driven use
- Neovim 0.11+
kiloonPATHopensslonPATH(optional): required for the editor integration channel. Without it, mentions fall back to typed text.:checkhealth kiloreports this.
{
"Kilo-Org/kilo.nvim",
config = function()
---@type kilo.Opts
vim.g.kilo_opts = {
-- Your configuration, if any
}
end,
}vim.pack.add({ src = "https://github.com/Kilo-Org/kilo.nvim" })---@type kilo.Opts annotations only resolve if your Lua LSP knows where to
find kilo.nvim's type definitions. If you use
lazydev.nvim, add a library entry
for it:
{
"folke/lazydev.nvim",
opts = {
library = {
{ path = "kilo.nvim", words = { "kilo" } },
},
},
},Without this, editing vim.g.kilo_opts still works at runtime, but
lua_ls reports "Undefined type or alias kilo.Opts" as a diagnostic.
The snippet below shows the default values.
---@type kilo.Opts
vim.g.kilo_opts = {
-- Split height when the split is at the bottom: a ratio of the window
-- (0 < h <= 1) or a row count (h > 1).
height = 0.30,
-- Split width when the split is on the side: a ratio of the window
-- (0 < w <= 1) or a column count (w > 1).
width = 0.40,
-- Side for a new split: "bottom" or "right".
side = "right",
-- Keymaps to register. Set to false to register none. Set an individual
-- key to false to disable only that one.
keys = {
toggle = "<leader>k.", -- toggle the Kilo terminal
range = "<leader>kr", -- send the visual selection
line = "<leader>kl", -- send the current line
side = "<leader>ks", -- move the split between the bottom and the right
},
}Options are read from vim.g.kilo_opts at call time. Keymaps are registered
once on VimEnter, so the table can be set in either lazy.nvim's init = or
config = function.
| Action | Default keymap | Command |
|---|---|---|
| Toggle the Kilo terminal | <leader>k. |
:KiloToggle |
| Move the split between bottom and right | <leader>ks |
:KiloToggleSide |
| Send the current line | <leader>kl |
:KiloSend |
| Send the visual selection | <leader>kr |
:KiloSend (with a range) |
| Send lines 5-9 | :5,9KiloSend |
Other usage tips, not specific to kilo.nvim:
- If mouse support is enabled in your Neovim config, you can use it to drag the separator and resize the Kilo split
- You can also click on the Kilo split or any other to focus them
- Use
Ctrl+jto insert a newline in the prompt box - Use
Ctrl+c(once!) to clear the prompt box - Use
Ctrl+dwithin the Kilo split to exit Kilo and close the split
require("kilo") exposes:
toggle(): toggle the Kilo terminal splittoggle_side(): move the split between the bottom and the rightsend_line(): send the current line to Kilosend_selection(): send the current visual selection to Kilo
When the Kilo terminal starts, kilo.nvim listens on a local WebSocket. If
Kilo connects back (over KILO_EDITOR_SSE_PORT), file mentions are delivered
over that channel and appear attached to the prompt. If no Kilo is connected,
mentions are typed into the terminal as @path#L-L, which Kilo's file
autocomplete parses.
Run :checkhealth kilo to verify the kilo binary, openssl, the Neovim
version, and the editor-integration state.