From 0e3f5dd9d2f992ef488f6aa901398e0ff2e2affa Mon Sep 17 00:00:00 2001 From: Oliver Hartmann Date: Sat, 25 Jan 2025 13:02:22 +0100 Subject: [PATCH] removed cmp from lazydev --- lua/plugins/cmp.lua | 217 ---------------------------------------- lua/plugins/lazydev.lua | 14 +-- 2 files changed, 2 insertions(+), 229 deletions(-) delete mode 100644 lua/plugins/cmp.lua diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua deleted file mode 100644 index 450aae5..0000000 --- a/lua/plugins/cmp.lua +++ /dev/null @@ -1,217 +0,0 @@ ----@diagnostic disable: missing-fields -return { - 'hrsh7th/nvim-cmp', - branch = 'main', - event = { 'InsertEnter', 'CmdlineEnter' }, - dependencies = { - { 'onsails/lspkind-nvim' }, - { 'hrsh7th/cmp-buffer' }, - { 'hrsh7th/cmp-nvim-lsp' }, - { 'L3MON4D3/LuaSnip' }, - { 'saadparwaiz1/cmp_luasnip' }, - { 'hrsh7th/cmp-nvim-lua' }, - { 'octaltree/cmp-look' }, - { 'hrsh7th/cmp-path' }, - { 'hrsh7th/cmp-calc' }, - { 'f3fora/cmp-spell' }, - { 'hrsh7th/cmp-emoji' }, - { 'hrsh7th/cmp-cmdline' }, - { 'dmitmel/cmp-cmdline-history' }, - { 'ray-x/cmp-treesitter' }, - { 'hrsh7th/cmp-nvim-lsp-signature-help' }, - { 'chrisgrieser/cmp_yanky' }, - { 'p00f/clangd_extensions.nvim' }, - { 'zbirenbaum/copilot-cmp' }, - { - 'windwp/nvim-autopairs', - config = true, - }, - }, - config = function() - local cmp = require('cmp') - local luasnip = require('luasnip') - local lspkind = require('lspkind') - - local t = function(str) - return vim.api.nvim_replace_termcodes(str, true, true, true) - end - - cmp.setup({ - preselect = cmp.PreselectMode.None, - mapping = { - [''] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c', 's' }), - [''] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c', 's' }), - [''] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c', 's' }), - [''] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c', 's' }), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c', 's' }), - [''] = cmp.mapping(cmp.mapping.close(), { 'i', 'c', 's' }), - [''] = cmp.mapping({ - i = function(fallback) - if cmp.visible() and cmp.get_active_entry() then - cmp.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = false }) - else - fallback() - end - end, - c = cmp.mapping.confirm({ select = false }), - s = cmp.mapping.confirm({ select = false }), - }), - [''] = cmp.mapping(function(fallback) - if luasnip.expand_or_jumpable() then - vim.api.nvim_feedkeys(t('luasnip-expand-or-jump'), '', true) - else - fallback() - end - end, { - 'i', - 's', - }), - [''] = cmp.mapping(function(fallback) - if luasnip.jumpable(-1) then - vim.api.nvim_feedkeys(t('luasnip-jump-prev'), '', true) - else - fallback() - end - end, { 'i', 's' }), - [''] = cmp.mapping( - cmp.mapping.complete({ - config = { - sources = { - { - name = 'cmdline_history', - }, - }, - }, - }), - { 'c' } - ), - }, - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) - end, - }, - sources = { - { name = 'copilot', priority = 9 }, - { name = 'codeium' }, - { name = 'luasnip', priority = 8 }, - { - name = 'nvim_lsp', - option = { - markdown_oxide = { - keyword_pattern = [[\(\k\| \|\/\|#\)\+]], - }, - }, - priority = 7, - }, - { name = 'nvim_lsp_signature_help', priority = 7 }, - -- { name = 'treesitter', priority = 6 }, - { - name = 'cmp_yanky', - option = { - -- only suggest items which match the current filetype - onlyCurrentFiletype = false, - -- only suggest items with a minimum length - minLength = 3, - }, - }, - { - name = 'buffer', - priority = 3, - option = { - get_bufnrs = function() - local bufs = {} - for _, win in ipairs(vim.api.nvim_list_wins()) do - bufs[vim.api.nvim_win_get_buf(win)] = true - end - return vim.tbl_keys(bufs) - end, - }, - }, - -- { name = 'nvim_lua' }, - -- { name = 'look' }, - { name = 'path' }, - -- { name = 'cmp_tabnine' }, - -- { name = 'calc' }, - -- { name = 'spell' }, - -- { name = 'emoji' }, - }, - enabled = function() - return vim.api.nvim_get_option_value('buftype', { buf = 0 }) ~= 'prompt' - or vim.api.nvim_get_option_value('filetype', { buf = 0 }) == 'dap-repl' - or vim.api.nvim_get_option_value('filetype', { buf = 0 }) == 'dapui_watches' - or vim.api.nvim_get_option_value('filetype', { buf = 0 }) == 'dapui_hover' - end, - -- completion = { - -- completeopt = 'menu,menuone,noinsert, noselect', - -- border = 'rounded', - -- }, - window = { - completion = cmp.config.window.bordered({ - col_offset = -3, - side_padding = 0, - winhighlight = 'Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None', - }), - documentation = cmp.config.window.bordered({ - winhighlight = 'Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None', - }), - }, - formatting = { - fields = { 'kind', 'abbr' }, - format = function(entry, vim_item) - local kind = lspkind.cmp_format({ - mode = 'symbol', - symbol_map = { - Codeium = '', - Copilot = '', - }, - maxwidth = 50, - })(entry, vim_item) - local strings = vim.split(kind.kind, '%s', { trimempty = true }) - kind.kind = ' ' .. (strings[1] or '') .. ' ' - return kind - end, - }, - -- experimental = { native_menu = true } - }) - vim.api.nvim_set_hl(0, "CmpItemKindCopilot", {fg ="#6CC644"}) - - -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). - cmp.setup.cmdline({ '/', '?' }, { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = 'buffer' }, - }, - }) - - -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). - cmp.setup.cmdline(':', { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = 'cmdline' }, - { name = 'cmdline_history' }, - { name = 'path' }, - { name = 'buffer' }, - }), - matching = { disallow_symbol_nonprefix_matching = false }, - }) - - require('cmp').setup.filetype({ 'dap-repl', 'dapui_watches', 'dapui_hover' }, { - sources = { - { name = 'dap' }, - }, - }) - - -- Autopairs - --require("nvim-autopairs.completion.cmp").setup({ - -- map_cr = true, - -- map_complete = true, - -- auto_select = true - --}) - local cmp_autopairs = require('nvim-autopairs.completion.cmp') - cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } })) - end, - enabled = false -} diff --git a/lua/plugins/lazydev.lua b/lua/plugins/lazydev.lua index b6557fc..9710f42 100644 --- a/lua/plugins/lazydev.lua +++ b/lua/plugins/lazydev.lua @@ -2,7 +2,7 @@ return { { 'folke/lazydev.nvim', ft = 'lua', -- only load on lua files - branch='main', + branch = 'main', opts = { library = { -- See the configuration section for more details @@ -14,15 +14,5 @@ return { { 'Bilal2453/luvit-meta', lazy = true, - }, -- optional `vim.uv` typings - { -- optional completion source for require statements and module annotations - 'hrsh7th/nvim-cmp', - opts = function(_, opts) - opts.sources = opts.sources or {} - table.insert(opts.sources, { - name = 'lazydev', - group_index = 0, -- set group index to 0 to skip loading LuaLS completions - }) - end, - }, + } }