Bropilot is a GitHub Copilot alternative that takes advantage of local LLMs through Ollama's API.
Current working models:
- qwen2.5-coder
- deepseek-coder
- deepseek-coder-v2
- starcoder2
- codellama
codegemma(doesn't seem to work anymore... ollama/ollama#4806)
You need to have Ollama installed and running for bro to work. Official download link
For Linux:
curl -fsSL https://ollama.com/install.sh | sh
# And check that the service is running
systemctl status ollama
Here is the default configuration.
auto_suggest
is a boolean that enables automatic debounced suggestionsexcluded_filetypes
is an array of filetypes ignored by theauto_suggest
option (#1)model
is a string (e.g. "codellama:7b-code" or "codegemma:2b-code")preset
is a boolean to enable/disabled predefined settings (See compatible models)model_params
is an optional table defining model params as per Ollama API paramsprompt
is a table defining theprefix
,suffix
andmiddle
keywords for FIMdebounce
is a number in milliseconds (this value gradually increases as long as curl does not respond to avoid overload issues)keymap
is a table to set the different keymap shortcuts (not using lazy keys to allow fallback to default behavior when suggestions are not active)
require('bropilot').setup({
auto_suggest = true,
excluded_filetypes = {},
model = "qwen2.5-coder:0.5b-base",
model_params = {
num_ctx = 32768,
},
preset = true,
debounce = 500,
keymap = {
accept_word = "<C-Right>",
accept_line = "<S-Right>",
accept_block = "<Tab>",
suggest = "<C-Down>",
},
ollama_url = "http://localhost:11434/api",
})
Install and configure using lazy.nvim
{
'meeehdi-dev/bropilot.nvim',
event = "VeryLazy", -- preload model on start
dependencies = {
"nvim-lua/plenary.nvim",
"j-hui/fidget.nvim",
},
config = true, -- setup with default options
}
-- or
{
'meeehdi-dev/bropilot.nvim',
event = "VeryLazy", -- preload model on start
dependencies = {
"nvim-lua/plenary.nvim",
"j-hui/fidget.nvim",
},
opts = {
auto_suggest = true,
model = "starcoder2:3b",
prompt = { -- FIM prompt for starcoder2
prefix = "<fim_prefix>",
suffix = "<fim_suffix>",
middle = "<fim_middle>",
},
debounce = 500,
keymap = {
accept_line = "<M-Right>",
},
},
config = function (_, opts)
require("bropilot").setup(opts)
end,
}