This guide explains how to run and test the KiloCode.nvim plugin locally.
- Neovim >= 0.7.0
- Lua/LuaJIT (for running tests with busted)
kilo-codeCLI (optional, plugin can auto-install)
The simplest way to test is to add the local plugin path to Neovim's runtimepath:
Create test_init.lua in the project root:
-- test_init.lua
-- Add the current directory to runtimepath
vim.opt.runtimepath:prepend(vim.fn.getcwd())
-- Load the plugin
require("kilo_code").setup({
auto_install = false, -- Set to true to test auto-installation
sidebar = {
position = "right",
width = 80,
},
file_watcher = {
enabled = true,
auto_reload = true,
},
})
-- Keymaps for testing
vim.keymap.set("n", "<leader>ko", ":KiloCodeOpen<CR>", { desc = "Open KiloCode" })
vim.keymap.set("n", "<leader>kt", ":KiloCodeToggle<CR>", { desc = "Toggle KiloCode" })
vim.keymap.set("n", "<leader>kc", ":KiloCodeClose<CR>", { desc = "Close KiloCode" })# From the project directory
nvim -u test_init.luaInside Neovim, try:
:KiloCodeCheck- Check if KiloCode is installed:KiloCodeOpen- Open the sidebar:KiloCodeToggle- Toggle the sidebar:KiloCodeClose- Close the sidebar- Use the keymaps
<leader>ko,<leader>kt,<leader>kc
If you use lazy.nvim as your plugin manager, you can point it to the local directory:
-- In your Neovim config (e.g., ~/.config/nvim/lua/plugins/kilo-code.lua)
return {
dir = "/path/to/kilo-code.nvim", -- Use local directory
-- OR for production: "mikaoelitiana/kilo-code.nvim",
config = function()
require("kilo_code").setup({
auto_install = true,
})
end,
}-- In your packer config
use {
"/path/to/kilo-code.nvim", -- Local path
config = function()
require("kilo_code").setup()
end,
}# Using LuaRocks
luarocks install busted
# Or using LuaRocks with LuaJIT
luarocks --lua-version=5.1 install busted# From the project directory
busted
# Or with verbose output
busted -v
# Run specific test file
busted spec/config_spec.lua# Using make (if you have a Makefile)
make test
# Or directly with nvim
nvim --headless -c "lua require('busted').run()" -c "qa!"luarocks install luacheck# Check all Lua files
luacheck lua/
# Check with specific config
luacheck lua/ --config .luacheckrc- Plugin loads without errors
-
:KiloCodeCheckshows correct installation status -
:KiloCodeOpencreates a sidebar with terminal -
:KiloCodeToggleopens and closes the sidebar -
:KiloCodeClosecloses the sidebar - File changes are detected (if file_watcher is enabled)
- Auto-reload works when files are modified externally
- Configuration options are respected
Add to your test config:
vim.opt.verbose = 2 -- Show all messages:messages:lua print(vim.inspect(require("kilo_code.config").get()))
:lua print(require("kilo_code").is_installed())
:lua print(require("kilo_code.install").get_version())Make sure the plugin directory is in Neovim's runtimepath:
vim.opt.runtimepath:prepend("/path/to/kilo-code.nvim")Ensure you're running tests with Neovim's Lua environment:
nvim --headless -c "lua require('busted').run()" -c "qa!"Check if KiloCode CLI is installed:
:KiloCodeCheckOr install it manually:
npm install -g @kilocode/cli