From 1491a28c3f5a7f369052f288d5c0cc2e81e92083 Mon Sep 17 00:00:00 2001 From: Ian Griffin Date: Fri, 16 Jan 2026 14:50:13 +0800 Subject: [PATCH] moved to nvim-cmp, replaced coq --- lua/plugins/10_ide.lua | 351 ++++++++++++++++++++++++++++------------- 1 file changed, 241 insertions(+), 110 deletions(-) diff --git a/lua/plugins/10_ide.lua b/lua/plugins/10_ide.lua index 83cf3bc..ec7ffbb 100644 --- a/lua/plugins/10_ide.lua +++ b/lua/plugins/10_ide.lua @@ -36,21 +36,151 @@ return { -- -- Autocompletion -- - { + --[[ { 'ms-jpq/coq.artifacts', branch = 'artifacts' - }, + }, ]]-- + -- { + -- 'ms-jpq/coq_nvim', + -- dependencies = { 'ms-jpq/coq.artifacts' }, + -- branch = 'coq', + -- build = ':COQdeps', + -- event = { "BufEnter" }, + -- config = function() + -- vim.cmd([[autocmd VimEnter * COQnow -s]]) + -- end + -- }, { - 'ms-jpq/coq_nvim', - dependencies = { 'ms-jpq/coq.artifacts' }, - branch = 'coq', - build = ':COQdeps', - event = { "BufEnter" }, - config = function() - vim.cmd([[autocmd VimEnter * COQnow -s]]) - end + "garymjr/nvim-snippets", + dependencies = { "rafamadriz/friendly-snippets" }, + opts = { + friendly_snippets = true, + }, + keys = { + { + "", + function() + if vim.snippet.active({ direction = 1 }) then + vim.schedule(function() vim.snippet.jump(1) end) + return + end + return "" + end, + expr = true, + silent = true, + mode = "i", + }, + { + "", + function() + if vim.snippet.active({ direction = 1 }) then + vim.schedule(function() vim.snippet.jump(1) end) + return + end + end, + expr = true, + silent = true, + mode = "s", + }, + { + "", + function() + if vim.snippet.active({ direction = -1 }) then + vim.schedule(function() vim.snippet.jump(-1) end) + return + end + return "" + end, + expr = true, + silent = true, + mode = { "i", "s" }, + }, + }, + }, + -- { + -- "tzachar/cmp-ai", + -- dependencies = "nvim-lua/plenary.nvim", + -- config = function() + -- local cmp_ai = require("cmp_ai.config") + -- + -- cmp_ai:setup({ + -- max_lines = 1000, + -- provider = "Ollama", -- Change to 'Ollama', 'HF', etc. as needed + -- provider_options = { + -- model = "qwen2.5-coder:latest", + -- }, + -- notify = true, + -- run_on_every_keystroke = true, + -- }) + -- end, + -- }, + { + "hrsh7th/nvim-cmp", + event = { "InsertEnter", "CmdlineEnter" }, + dependencies = { + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-nvim-lsp-signature-help", + "hrsh7th/cmp-nvim-lsp-document-symbol", + "hrsh7th/cmp-cmdline", + "amarz45/nvim-cmp-fonts", + -- "tzachar/cmp-ai", + "garymjr/nvim-snippets", -- Ensure the snippet source is loaded + }, + config = function() + local cmp = require("cmp") + + cmp.setup({ + snippet = { + expand = function(args) + -- Use native neovim snippets + vim.snippet.expand(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "snippets" }, -- This comes from nvim-snippets + { name = "nvim_lsp_signature_help" }, + { name = "cmp_ai" }, + }, { + { name = "buffer" }, + { name = "path" }, + { name = "fonts", option = { space_filter = "-" } }, + }), + }) + + -- ... (Keep cmdline setup as before) ... + cmp.setup.cmdline({ "/", "?" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "nvim_lsp_document_symbol" }, + { name = "buffer" }, + }, + }) + + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), + matching = { disallow_symbol_nonprefix_matching = false }, + }) + end, }, - -- -- Language Configurations -- @@ -99,6 +229,80 @@ return { -- Language Server -- + -- Language Server Installer + { + 'mason-org/mason.nvim', + lazy = false, + cmd = { + "Mason", + "MasonInstall", + "MasonUpdate", + + }, + opts = { + ui = { + icons = { + package_installed = "i", + package_pending = "p", + package_uninstalled = "u" + }, + }, + }, + }, + --[[{ + 'huggingface/llm.nvim', + opts = { + model = 'deepseek-coder-v2', + backend = 'ollama', + url = 'http://localhost:11434', + tokens_to_clear = {"<|endoftext|>", "```", "python", "lua"}, + lsp = { + bin_path = vim.api.nvim_call_function("stdpath", { "data" }) .. "/mason/bin/llm-ls", + }, + context_window = 10240, + enable_suggestions_on_startup = true, + }, + }, + { + 'jacob411/Ollama-Copilot', + ft = {'python', 'lua', 'go', "markdown"}, + opts = { + model_name = "qwen2.5-coder:latest", + filetypes = {'python', 'lua','vim', "markdown"}, + ollama_model_opts = { + num_predict = 40, + temperature = 0.1, + }, + } + },]]-- + { + 'mason-org/mason-lspconfig.nvim', + dependencies = { + 'mason-org/mason.nvim', + -- 'ms-jpq/coq_nvim', + -- 'nanotee/nvim-lsp-basics', + -- 'neovim/nvim-lspconfig', + -- 'huggingface/llm.nvim', + -- 'stevearc/aerial.nvim', + }, + opts = { + ensure_installed = { + "bashls", + "clangd", + "gopls", + "html", + "jsonls", + "lua_ls", + "omnisharp", + "phpactor", + "pyright", + "sqls", + "texlab", + "ts_ls" + }, + }, + }, + -- Show Code Outline/Symbols tree window { 'stevearc/aerial.nvim', @@ -126,73 +330,31 @@ return { } }, - -- Language Server Installer - { - 'williamboman/mason.nvim', - lazy = false, - cmd = { - "Mason", - "MasonInstall", - "MasonUpdate", + -- Show code diagnostics in a separate buffer window + { + 'folke/trouble.nvim', + opts = {}, + + cmd = { + "Trouble", }, - opts = { - ui = { - icons = { - package_installed = "i", - package_pending = "p", - package_uninstalled = "u" - }, - }, - }, + + keys = { + {'t', ':Trouble diagnostics toggle'}, + } }, { 'neovim/nvim-lspconfig', - config = function() - -- disable inline error messages - vim.diagnostic.config({ virtual_text = false }) - end - }, - --[[{ - 'huggingface/llm.nvim', - opts = { - model = 'deepseek-coder-v2', - backend = 'ollama', - url = 'http://localhost:11434', - tokens_to_clear = {"<|endoftext|>", "```", "python", "lua"}, - lsp = { - bin_path = vim.api.nvim_call_function("stdpath", { "data" }) .. "/mason/bin/llm-ls", - }, - context_window = 10240, - enable_suggestions_on_startup = true, - }, - },]]-- - { - 'mason-org/mason-lspconfig.nvim', dependencies = { - 'williamboman/mason.nvim', - 'ms-jpq/coq_nvim', - 'nanotee/nvim-lsp-basics', - 'neovim/nvim-lspconfig', - -- 'huggingface/llm.nvim', + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-nvim-lsp-document-symbol", + "hrsh7th/cmp-nvim-lsp-signature-help", + 'folke/trouble.nvim', + 'mason-org/mason-lspconfig.nvim', + 'mason-org/mason.nvim', 'stevearc/aerial.nvim', }, - opts = { - ensure_installed = { - "bashls", - "clangd", - "gopls", - "html", - "jsonls", - "lua_ls", - "omnisharp", - "phpactor", - "pyright", - "sqls", - "texlab", - "ts_ls" - }, - }, ft = { "bash", "c", @@ -212,47 +374,16 @@ return { "typescript", "typescriptreact", }, - --[[ config = function() - vim.lsp.config('*', require('coq').lsp_ensure_capabilities { - on_attach = function(client, bufnr) - local basics = require('lsp_basics') - basics.make_lsp_commands(client, bufnr) - basics.make_lsp_mappings(client, bufnr) - end + config = function() + -- disable inline error messages + vim.diagnostic.config({ virtual_text = false }) + local capabilities = require('cmp_nvim_lsp').default_capabilities() + + vim.lsp.config('*', { + capabilities = capabilities, }) - end, ]]-- - - -- config = function() - -- local masonlsp = require 'mason-lspconfig' - -- --[[ - -- masonlsp.setup - -- --]] - -- masonlsp.setup_handlers { - -- function(server_name) - -- require('lspconfig')[server_name].setup(require('coq').lsp_ensure_capabilities { - -- on_attach = function(client, bufnr) - -- local basics = require('lsp_basics') - -- basics.make_lsp_commands(client, bufnr) - -- basics.make_lsp_mappings(client, bufnr) - -- end - -- }) - -- end - -- } - -- end, - }, - - -- Show code diagnostics in a separate buffer window - { - 'folke/trouble.nvim', - opts = {}, - - cmd = { - "Trouble", - }, - - keys = { - {'t', ':Trouble diagnostics toggle'}, - } + + end }, -- -- Markdown Live Preview