{ plugins = { friendly-snippets = { enable = true; }; luasnip = { enable = true; settings = { enable_autosnippets = true; store_selection_keys = ""; }; fromLua = [ { paths = ../snippets; } ]; }; lspkind = { enable = true; symbolMap = { Namespace = "󰌗"; Text = "󰉿"; Method = "󰆧"; Function = "󰆧"; Constructor = ""; Field = "󰜢"; Variable = "󰀫"; Class = "󰠱"; Interface = ""; Module = ""; Property = "󰜢"; Unit = "󰑭"; Value = "󰎠"; Enum = ""; Keyword = "󰌋"; Snippet = ""; Color = "󰏘"; File = "󰈚"; Reference = "󰈇"; Folder = "󰉋"; EnumMember = ""; Constant = "󰏿"; Struct = "󰙅"; Event = ""; Operator = "󰆕"; TypeParameter = "󰊄"; Table = ""; Object = "󰅩"; Tag = ""; Array = "[]"; Boolean = ""; Number = ""; Null = "󰟢"; String = "󰉿"; Calendar = ""; Watch = "󰥔"; Package = ""; Codeium = ""; Copilot = ""; TabNine = ""; }; }; cmp = { enable = true; autoEnableSources = true; settings = { snippet.expand = '' function(args) require('luasnip').lsp_expand(args.body) end ''; completion.completeopt = "menu,preview"; sources = [ { name = "luasnip"; } { name = "nvim_lsp"; } { name = "nvim_lsp_signature_help"; } { name = "nvim_lsp_document_symbol"; } { name = "codeium"; } { name = "path"; } { name = "buffer"; } { name = "treesitter"; } ]; mapping = { __raw = '' cmp.mapping.preset.insert({ [''] = cmp.mapping({ c = function() if cmp.visible() then cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) else vim.api.nvim_feedkeys(t(''), 'n', true) end end, i = function(fallback) if cmp.visible() then cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) else fallback() end end }), [''] = cmp.mapping({ c = function() if cmp.visible() then cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select }) else vim.api.nvim_feedkeys(t(''), 'n', true) end end, i = function(fallback) if cmp.visible() then cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select }) else fallback() end end }), [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), {'i', 'c'}), [''] = cmp.mapping(cmp.mapping.scroll_docs(4), {'i', 'c'}), [''] = cmp.mapping(cmp.mapping.complete(), {'i', 'c'}), [''] = cmp.mapping({ i = cmp.mapping.close(), c = cmp.mapping.close() }), [''] = cmp.mapping.confirm({ select = true }), [''] = cmp.mapping(cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), {'i'}), [''] = cmp.mapping(cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), {'i'}), [""] = cmp.mapping({ c = function() if cmp.visible() then cmp.select_next_item({ behavior = cmp.SelectBehavior.Insert }) else cmp.complete() end end, i = function(fallback) local has_words_before = function() local unpack = unpack or table.unpack local line, col = unpack(vim.api.nvim_win_get_cursor(0)) return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil end if cmp.visible() then cmp.select_next_item() elseif require('luasnip').expand_or_jumpable() then require('luasnip').expand_or_jump() elseif has_words_before() then cmp.complete() else fallback() end end, s = function(fallback) local has_words_before = function() local unpack = unpack or table.unpack local line, col = unpack(vim.api.nvim_win_get_cursor(0)) return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil end if cmp.visible() then cmp.select_next_item() elseif require('luasnip').expand_or_jumpable() then require('luasnip').expand_or_jump() elseif has_words_before() then cmp.complete() else fallback() end end }), [""] = cmp.mapping({ c = function() if cmp.visible() then cmp.select_prev_item({ behavior = cmp.SelectBehavior.Insert }) else cmp.complete() end end, i = function(fallback) if cmp.visible() then cmp.select_prev_item() elseif require('luasnip').jumpable(-1) then require('luasnip').jump(-1) else fallback() end end, s = function(fallback) if cmp.visible() then cmp.select_prev_item() elseif require('luasnip').jumpable(-1) then require('luasnip').jump(-1) else fallback() end end }), }) ''; }; }; cmdline = { "/" = { sources = [ { name = "buffer"; } ]; }; ":" = { completion.completeopt = "menu,menuone,noselect"; mapping = { __raw = '' cmp.mapping.preset.cmdline({ [""] = cmp.mapping.confirm { select = true }, }) ''; }; sources = [ { name = "path"; } { name = "cmdline"; } ]; }; "?" = { mapping = { completion.completeopt = "menu,menuone,noselect"; __raw = "cmp.mapping.preset.cmdline({ [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.abort(), [''] = cmp.mapping.confirm({ select = true }), })"; }; sources = [ { name = "cmdline"; ignoreCmds = [ "Man" "!" ]; } ]; }; }; }; }; }