diff options
| author | Nanderty <psopka@sopka.ch> | 2023-03-12 15:07:53 +0100 |
|---|---|---|
| committer | Nanderty <psopka@sopka.ch> | 2023-03-12 15:07:53 +0100 |
| commit | c87bea68983be1a4ab0bdce3bb2ac19ad35f0a81 (patch) | |
| tree | 245b4cca0fb59a5abdff645fa8bd145a021a7908 /lua/Nanderty/Plugins/cmp.lua | |
| download | neovim-config-c87bea68983be1a4ab0bdce3bb2ac19ad35f0a81.tar.gz neovim-config-c87bea68983be1a4ab0bdce3bb2ac19ad35f0a81.tar.bz2 neovim-config-c87bea68983be1a4ab0bdce3bb2ac19ad35f0a81.zip | |
neovim setup
Diffstat (limited to 'lua/Nanderty/Plugins/cmp.lua')
| -rw-r--r-- | lua/Nanderty/Plugins/cmp.lua | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/lua/Nanderty/Plugins/cmp.lua b/lua/Nanderty/Plugins/cmp.lua new file mode 100644 index 0000000..2c73b05 --- /dev/null +++ b/lua/Nanderty/Plugins/cmp.lua @@ -0,0 +1,60 @@ +require('mason').setup() + +require('mason-lspconfig').setup({ + ensure_installed = { + } +}) + +local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities() +local lsp_attach = function(client, bufnr) +end + +local lspconfig = require('lspconfig') +require('mason-lspconfig').setup_handlers({ + function(server_name) + lspconfig[server_name].setup({ + on_attach = lsp_attach, + capabilities = lsp_capabilities, + }) + end, +}) + +local cmp = require'cmp' + +cmp.setup({ + snippet = { + expand = function(args) + vim.fn["UltiSnips#Anon"](args.body) + end, + }, + window = { + }, + mapping = cmp.mapping.preset.insert({ + ['<C-b>'] = cmp.mapping.scroll_docs(-4), + ['<C-f>'] = cmp.mapping.scroll_docs(4), + ['<C-Space>'] = cmp.mapping.complete(), + ['<C-e>'] = cmp.mapping.abort(), + ['<CR>'] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'ultisnips' }, + { name = 'omni' }, + { name = 'buffer' }, + }) +}) + +local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities() +local lsp_attach = function(client, bufnr) + -- Create your keybindings here... +end + +local lspconfig = require('lspconfig') +require('mason-lspconfig').setup_handlers({ + function(server_name) + lspconfig[server_name].setup({ + on_attach = lsp_attach, + capabilities = lsp_capabilities, + }) + end, +}) |
