aboutsummaryrefslogtreecommitdiff
path: root/nvim/lua/plugins/completion.lua
blob: 2db549f1d2c418e05fa04df188670fb07de25037 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
return {
	{
		"windwp/nvim-autopairs",
		event = "InsertEnter",
		config = true
	},{
		"hrsh7th/nvim-cmp",
		dependencies = {
			'hrsh7th/cmp-nvim-lsp',
			'hrsh7th/cmp-buffer',
			'hrsh7th/cmp-path',
			'hrsh7th/cmp-cmdline',
			'hrsh7th/cmp-vsnip', 
			'hrsh7th/vim-vsnip'
		},
		config = function()
			local cmp_autopairs = require'nvim-autopairs.completion.cmp'
			local cmp = require'cmp'
			cmp.setup {
				snippet = {
					expand = function(args)
						vim.fn["vsnip#anonymous"](args.body)
					end,
				},
				window = {
					completion = cmp.config.window.bordered(),
					documentation = cmp.config.window.bordered(),
				},
				mapping = cmp.mapping.preset.insert({
					['<C-Space>'] = cmp.mapping.complete(),
					['<C-e>'] = cmp.mapping.abort(),
					['<CR>'] = cmp.mapping.confirm({ select = true }),
				}),
				sources = cmp.config.sources({
					{ name = 'nvim_lsp' },
					{ name = 'vsnip' },
				},{
					{ name = 'buffer' },
				})
			}

			cmp.event:on(
				'confirm_done',
				cmp_autopairs.on_confirm_done()
			)
		end,
	},{
		'neovim/nvim-lspconfig',
		config = function()
			local lspconfig = require('lspconfig')

			lspconfig.rust_analyzer.setup {}
			lspconfig.pyright.setup {}
			lspconfig.clangd.setup {}
			lspconfig.texlab.setup {}
		end,

	},
}