Neovim#
Voir aussi
Installation#
Debian#
$ sudo apt-get install update && apt-get install neovim
Configuration#
Plugin#
~/.config/nvim/init.lua#
vim.cmd([[
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc
highlight Normal guibg=none
highlight NonText guibg=none
highlight Normal ctermbg=none
highlight NonText ctermbg=none
]])
-- https://fredrikaverpil.github.io/blog/2026/04/15/from-lazy.nvim-to-vim.pack/
local merge = require("merge")
_G.Config = {
cmp = {},
minuet = {},
}
function _G.Config.add(spec)
merge(_G.Config, spec)
end
~/.config/nvim/plugin/cmp.lua#
vim.pack.add({
{
src = 'https://github.com/hrsh7th/cmp-nvim-lsp',
version = 'cbc7b02',
},
{
src = 'https://github.com/hrsh7th/cmp-buffer',
version = 'b74fab3',
},
{
src = 'https://github.com/hrsh7th/cmp-path',
version = 'c642487',
},
{
src = 'https://github.com/hrsh7th/nvim-cmp',
version = '2ffe79f',
},
{
src = 'https://github.com/quangnguyen30192/cmp-nvim-tags',
version = 'e126a09',
},
})
-- Register nvim-cmp lsp capabilities
vim.lsp.config("*", { capabilities = require("cmp_nvim_lsp").default_capabilities() })
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
local auto_select = true
local cmp = require("cmp")
local cmp_config_default = require("cmp.config.default")()
cmp.setup({
snippet = {
expand = function(args)
vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
end,
},
auto_brackets = {}, -- configure any filetype to auto add brackets
completion = {
completeopt = "menu,menuone,noinsert" .. (auto_select and "" or ",noselect"),
},
preselect = auto_select and cmp.PreselectMode.Item or cmp.PreselectMode.None,
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
-- { name = "lazydev" },
{ name = "nvim_lsp" },
{ name = "tags" },
{ name = "path" },
{ name = "minuet" },
-- { name = "llm" },
}, {
{ name = "buffer" },
}),
sorting = cmp_config_default.sorting,
performance = {
-- It is recommended to increase the timeout duration due to
-- the typically slower response speed of LLMs compared to
-- other completion sources. This is not needed when you only
-- need manual completion.
fetching_timeout = 5000,
},
})
~/.config/nvim/plugin/gitsigns.lua#
vim.pack.add({
{
src = 'https://github.com/lewis6991/gitsigns.nvim',
version = '31d6fb2',
},
})
~/.config/nvim/plugin/minuet.lua#
vim.pack.add({
{
src = 'https://github.com/milanglacier/minuet-ai.nvim',
version = 'd29dec4',
},
})
require('minuet').setup {
provider = 'openai_fim_compatible',
n_completions = 3, -- recommend for local model for resource saving
-- I recommend beginning with a small context window size and incrementally
-- expanding it, depending on your local computing power. A context window
-- of 512, serves as an good starting point to estimate your computing
-- power. Once you have a reliable estimate of your local computing power,
-- you should adjust the context window to a larger value.
context_window = 512,
provider_options = {
openai_fim_compatible = {
-- For Windows users, TERM may not be present in environment variables.
-- Consider using APPDATA instead.
api_key = 'TERM',
name = 'llama.cpp',
end_point = 'http://127.0.0.1:11434/v1/completions',
-- The model is set by the llama-cpp server and cannot be altered
-- post-launch.
model = 'qwen2.5-coder-3b-q8_0',
optional = {
max_tokens = 128,
top_p = 0.9,
},
-- Llama.cpp does not support the `suffix` option in FIM completion.
-- Therefore, we must disable it and manually populate the special
-- tokens required for FIM completion.
template = {
prompt = function(context_before_cursor, context_after_cursor, _)
return '<|fim_prefix|>'
.. context_before_cursor
.. '<|fim_suffix|>'
.. context_after_cursor
.. '<|fim_middle|>'
end,
suffix = false,
},
},
},
}
lua#
Le « merge » de configuration n’est pas utilisé pour le moment.
~/.config/nvim/lua/merge.lua#
-- https://fredrikaverpil.github.io/blog/2026/04/15/from-lazy.nvim-to-vim.pack/
local function merge(base, override)
for k, v in pairs(override) do
if v == vim.NIL then
base[k] = nil
elseif type(v) == "table" then
local bv = base[k]
if type(bv) ~= "table" then
base[k] = v
elseif vim.islist(v) then
for _, item in ipairs(v) do
if type(item) == "table" or not vim.list_contains(bv, item) then
table.insert(bv, item)
end
end
else
merge(bv, v)
end
else
base[k] = v
end
end
return base
end
return merge
Alternatives#
$ sudo update-alternatives --set editor /usr/bin/nvim