diff options
| author | fschildt <florian.schildt@protonmail.com> | 2025-11-30 01:49:54 +0100 |
|---|---|---|
| committer | fschildt <florian.schildt@protonmail.com> | 2025-11-30 01:49:54 +0100 |
| commit | e57b85a92b2ac9120d4685bbd926773d599b6555 (patch) | |
| tree | 50cce8779924cd17b7ea886e1a552fced1c661ba /.config/nvim/lua/custom/plugins/cmp.lua | |
| parent | 99af108f8cd0560344fb7c8e6d027355e3f4b933 (diff) | |
Diffstat (limited to '.config/nvim/lua/custom/plugins/cmp.lua')
| -rw-r--r-- | .config/nvim/lua/custom/plugins/cmp.lua | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/.config/nvim/lua/custom/plugins/cmp.lua b/.config/nvim/lua/custom/plugins/cmp.lua new file mode 100644 index 0000000..51d0a30 --- /dev/null +++ b/.config/nvim/lua/custom/plugins/cmp.lua @@ -0,0 +1,53 @@ +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-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 }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'vsnip' }, + { name = 'friendly-snippets '} + }, { + { name = 'buffer' }, + }) +}) + +-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } +}) + +-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }), + matching = { disallow_symbol_nonprefix_matching = false } +}) + + +local capabilities = require('cmp_nvim_lsp').default_capabilities() +vim.lsp.config('*', { + capabilities = capabilities, +}) + |
