Configuration for my NixOS based systems and Home Manager
at shizuri 44 lines 1.6 kB view raw
1-- Copied from https://github.com/hrsh7th/nvim-cmp/?tab=readme-ov-file#recommended-configuration 2return function() 3 local cmp = require('cmp') 4 cmp.setup({ 5 snippet = { 6 -- REQUIRED - you must specify a snippet engine 7 expand = function(args) 8 vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. 9 end 10 }, 11 window = { 12 completion = cmp.config.window.bordered(), 13 documentation = cmp.config.window.bordered() 14 }, 15 mapping = cmp.mapping.preset.insert({ 16 ['<C-b>'] = cmp.mapping.scroll_docs(-4), 17 ['<C-f>'] = cmp.mapping.scroll_docs(4), 18 ['<C-Space>'] = cmp.mapping.complete(), 19 ['<C-e>'] = cmp.mapping.abort(), 20 ['<CR>'] = cmp.mapping.confirm({ select = true }) -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. 21 }), 22 sources = cmp.config.sources({ 23 { name = 'lazydev', group_index = 0 }, 24 { name = 'nvim_lsp' }, 25 { name = 'vsnip' }, -- For vsnip users. 26 { name = 'supermaven' }, 27 { name = 'conjure' }, 28 }, 29 { { name = 'buffer' } }) 30 }) 31 require("cmp_git").setup() 32 -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). 33 cmp.setup.cmdline({ '/', '?' }, { 34 mapping = cmp.mapping.preset.cmdline(), 35 sources = { { name = 'buffer' } } 36 }) 37 38 -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). 39 cmp.setup.cmdline(':', { 40 mapping = cmp.mapping.preset.cmdline(), 41 sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }), 42 matching = { disallow_symbol_nonprefix_matching = false } 43 }) 44end