Configuration for my NixOS based systems and Home Manager
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 -- Accept the selected item, or the first item if none is selected.
21 ['<CR>'] = cmp.mapping.confirm({ select = true })
22 }),
23 sources = cmp.config.sources({
24 { name = 'lazydev', group_index = 0 },
25 { name = 'nvim_lsp' },
26 { name = 'vsnip' }, -- For vsnip users.
27 { name = 'supermaven' },
28 { name = 'conjure' },
29 },
30 { { name = 'buffer' } })
31 })
32 require("cmp_git").setup()
33 -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
34 cmp.setup.cmdline({ '/', '?' }, {
35 mapping = cmp.mapping.preset.cmdline(),
36 sources = { { name = 'buffer' } }
37 })
38
39 -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
40 cmp.setup.cmdline(':', {
41 mapping = cmp.mapping.preset.cmdline(),
42 sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }),
43 matching = { disallow_symbol_nonprefix_matching = false }
44 })
45end