diff options
Diffstat (limited to '.config/nvim/lua/plugins/cmp.lua')
| -rw-r--r-- | .config/nvim/lua/plugins/cmp.lua | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua deleted file mode 100644 index 7126173..0000000 --- a/.config/nvim/lua/plugins/cmp.lua +++ /dev/null @@ -1,93 +0,0 @@ -return { - { - "hrsh7th/nvim-cmp", - event = { "InsertEnter", "CmdlineEnter" }, -- Load on insert or cmdline mode - dependencies = { - "hrsh7th/cmp-nvim-lsp", -- LSP completion source - "hrsh7th/cmp-buffer", -- Buffer completion source - "hrsh7th/cmp-path", -- Path completion source - "hrsh7th/cmp-cmdline", -- Cmdline completion source - "L3MON4D3/LuaSnip", -- Snippet engine - "saadparwaiz1/cmp_luasnip", -- LuaSnip completion source - "rafamadriz/friendly-snippets", -- Predefined snippets - "onsails/lspkind.nvim", -- Icons for completion items - }, - config = function() - local cmp = require("cmp") - local luasnip = require("luasnip") - local lspkind = require("lspkind") - - -- Load friendly-snippets - require("luasnip.loaders.from_vscode").lazy_load() - - cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - ["<C-b>"] = cmp.mapping.scroll_docs(-4), -- Scroll up docs - ["<C-f>"] = cmp.mapping.scroll_docs(4), -- Scroll down docs - ["<C-Space>"] = cmp.mapping.complete(), -- Trigger completion - ["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept selection - ["<Tab>"] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { "i", "s" }), - ["<S-Tab>"] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, -- LSP completions - { name = "luasnip" }, -- Snippet completions - { name = "buffer" }, -- Buffer completions - { name = "path" }, -- Path completions - }), - formatting = { - format = lspkind.cmp_format({ - mode = "symbol_text", -- Show symbol and text - maxwidth = 50, -- Limit width - ellipsis_char = "...", -- Truncation character - }), - }, - window = { - completion = cmp.config.window.bordered(), -- Bordered completion menu - documentation = cmp.config.window.bordered(), -- Bordered documentation window - }, - experimental = { - ghost_text = true, -- Show ghost text for inline completion - }, - } - - -- Command-line completion for `/` and `?` - cmp.setup.cmdline({ "/", "?" }, { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = "buffer" }, - }, - }) - - -- Command-line completion for `:` - cmp.setup.cmdline(":", { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = "path" }, - { name = "cmdline" }, - }), - }) - end, - }, -} |
