From bc020fba1ac260f8cc6d0230f8b8ea75dd20b686 Mon Sep 17 00:00:00 2001 From: probalazs Date: Sat, 18 Apr 2026 19:09:26 +0200 Subject: [PATCH] Add llama.vim, LlamaStart/Stop commands, and fix completion preset - Add llama.vim plugin with optimized FIM context settings - Add LlamaStart/LlamaStop commands for managing llama-server - Auto-stop llama-server on Neovim exit - Switch blink.cmp back to default preset (Ctrl+y) for Tab compatibility Co-Authored-By: Claude Sonnet 4.6 --- init.lua | 32 +++++++++++++++++++++++++++++++- lua/custom/plugins/init.lua | 11 +++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 48b3dabb..0e69b7dd 100644 --- a/init.lua +++ b/init.lua @@ -223,6 +223,36 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the upper win vim.keymap.set('n', 'sv', 'vsp', { desc = '[S]plit [V]ertical' }) vim.keymap.set('n', 'sh', 'sp', { desc = '[S]plit [H]orizontal' }) +local llama_job_id = nil + +vim.api.nvim_create_user_command('LlamaStart', function() + if llama_job_id then + vim.notify('llama-server is already running', vim.log.levels.WARN) + return + end + llama_job_id = vim.fn.jobstart('llama-server --fim-qwen-3b-default -c 16384', { detach = true }) + vim.notify('llama-server started', vim.log.levels.INFO) +end, { desc = 'Start llama-server' }) + +vim.api.nvim_create_user_command('LlamaStop', function() + if not llama_job_id then + vim.notify('llama-server is not running', vim.log.levels.WARN) + return + end + vim.fn.jobstop(llama_job_id) + llama_job_id = nil + vim.notify('llama-server stopped', vim.log.levels.INFO) +end, { desc = 'Stop llama-server' }) + +vim.api.nvim_create_autocmd('VimLeavePre', { + callback = function() + if llama_job_id then + vim.fn.jobstop(llama_job_id) + llama_job_id = nil + end + end, +}) + -- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes -- vim.keymap.set("n", "", "H", { desc = "Move window to the left" }) @@ -779,7 +809,7 @@ require('lazy').setup({ -- : Toggle signature help -- -- See :h blink-cmp-config-keymap for defining your own keymap - preset = 'super-tab', + preset = 'default', -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 7993a34f..00beadee 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -13,6 +13,17 @@ return { }, }, { 'editorconfig/editorconfig-vim' }, + { + 'ggml-org/llama.vim', + init = function() + vim.g.llama_config = { + n_predict = 256, -- longer suggestions + ring_n_chunks = 64, -- more project context chunks + ring_chunk_size = 64, -- smaller chunks for speed + ring_scope = 2048, -- wider scope around cursor + } + end, + }, { 'folke/flash.nvim', event = 'VeryLazy',