From d7a21ce1a5c73a0265e05141dd50597900751f4f Mon Sep 17 00:00:00 2001 From: Raoul Branten Date: Thu, 15 Jan 2026 13:09:45 +0100 Subject: [PATCH] Use llama --- lua/config/plugin/cmp.lua | 11 +++++- lua/config/plugin/init.lua | 1 + lua/config/plugin/minuet.lua | 39 ++++++++++++++++++++ lua/plugins/init.lua | 71 ++++++------------------------------ 4 files changed, 62 insertions(+), 60 deletions(-) create mode 100644 lua/config/plugin/minuet.lua diff --git a/lua/config/plugin/cmp.lua b/lua/config/plugin/cmp.lua index 399ee0b..4af5a8d 100644 --- a/lua/config/plugin/cmp.lua +++ b/lua/config/plugin/cmp.lua @@ -10,6 +10,7 @@ cmp.setup({ }, mapping = cmp.mapping.preset.insert({ + [""] = require('minuet').make_cmp_map(), [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), @@ -36,13 +37,21 @@ cmp.setup({ }), sources = cmp.config.sources({ + { name = 'minuet' }, { name = 'nvim_lsp', priority = 1000 }, { name = 'luasnip', priority = 750 }, - }, { { name = 'buffer', priority = 500 }, { name = 'path', priority = 250 }, }), + 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 = 2000, + }, + sorting = { comparators = { cmp.config.compare.offset, diff --git a/lua/config/plugin/init.lua b/lua/config/plugin/init.lua index 1c2a30e..cc177ca 100644 --- a/lua/config/plugin/init.lua +++ b/lua/config/plugin/init.lua @@ -18,3 +18,4 @@ require("config.plugin.lsp") require("config.plugin.luasnip") require("config.plugin.gruvbox") require("config.plugin.cmp") +require("config.plugin.minuet") diff --git a/lua/config/plugin/minuet.lua b/lua/config/plugin/minuet.lua new file mode 100644 index 0000000..8c7461a --- /dev/null +++ b/lua/config/plugin/minuet.lua @@ -0,0 +1,39 @@ +require('minuet').setup { + provider = 'openai_fim_compatible', + n_completions = 1, -- 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://localhost:8012/v1/completions', + -- The model is set by the llama-cpp server and cannot be altered + -- post-launch. + model = 'PLACEHOLDER', + optional = { + max_tokens = 56, + 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, + }, + }, + }, +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 69dfeed..7ce4ef8 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -248,63 +248,16 @@ return { end, }, -- AI --- { --- "supermaven-inc/supermaven-nvim", --- config = function() --- require("supermaven-nvim").setup({}) --- end, --- }, + { + 'milanglacier/minuet-ai.nvim', + dependencies = { + "nvim-lua/plenary.nvim", + "hrsh7th/nvim-cmp", + }, + config = function() + require('minuet').setup { + -- Your configuration options here + } + end, + }, } ---"williamboman/mason.nvim", ---"williamboman/mason-lspconfig.nvim", ---"neovim/nvim-lspconfig", - --# neo-tree, a filebrowser - --{ - -- "nvim-neo-tree/neo-tree.nvim", - -- keys = { - -- { "ft", "Neotree toggle", desc = "NeoTree" }, - -- }, - -- opts = {}, - --}, - ---- ui plugin is a collection of many UI modules like statusline, tabline, cheatsheet, nvdash and much more! - --"nvim-lua/plenary.nvim", - --{ - -- "nvim-tree/nvim-web-devicons", - -- lazy = true - --}, - --{ - -- "nvchad/ui", - -- config = function() - -- require "nvchad" - -- end - --}, - --{ - -- "nvchad/base46", - -- lazy = true, - -- build = function() - -- require("base46").load_all_highlights() - -- end, - --}, - --{ - -- "dundalek/lazy-lsp.nvim", - -- commit="0ccc0238be37351d53e64c2f6c7f9e106e2bdb68", - -- dependencies = { - -- "neovim/nvim-lspconfig", - -- {"VonHeikemen/lsp-zero.nvim", branch = "v3.x"}, - -- "hrsh7th/cmp-nvim-lsp", - -- "hrsh7th/nvim-cmp", - -- }, - -- config = function() - -- local lsp_zero = require("lsp-zero") - - -- lsp_zero.on_attach(function(client, bufnr) - -- -- see :help lsp-zero-keybindings to learn the available actions - -- lsp_zero.default_keymaps({ - -- buffer = bufnr, - -- preserve_mappings = false - -- }) - -- end) - - -- require("lazy-lsp").setup {} - -- end, - --},