lua << EOF

-- Setup nvim-cmp.
local cmp = require'cmp'

cmp.setup({
    snippet = {
        expand = function(args)
        -- For `vsnip` user.
        -- vim.fn["vsnip#anonymous"](args.body)

        -- For `luasnip` user.
        -- require('luasnip').lsp_expand(args.body)

        -- For `ultisnips` user.
        vim.fn["UltiSnips#Anon"](args.body)
        end,
    },
    mapping = {
        ['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
        ['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
        ['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
        ['<tab>'] = cmp.mapping.confirm({ select = true }),
        ['<C-e>'] = cmp.mapping({
          i = cmp.mapping.abort(),
          c = cmp.mapping.close(),
        }),
    },
    sources = cmp.config.sources({
        { name = 'nvim_lsp' },

        { name = 'path' },

        { name = 'ultisnips' },

        { name = 'calc' },

        { name = 'cmp_git' },
    }, {
        { name = 'buffer', keyword_length = 5, max_item_count = 10, priority = -5 },
    }),
    experimental = {
        native_menu = false
    }
})

cmp.setup.cmdline('/', {
    sources = {
        { name = 'buffer' }
    }
})

cmp.setup.cmdline(':', {
    sources = {
      { name = 'cmdline' }
    }
})

require("cmp_git").setup()

EOF
