diff options
| author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-03-21 00:29:03 +0100 |
|---|---|---|
| committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-03-21 00:29:03 +0100 |
| commit | 0b79c66a7265839500c9c29fce9b2f9662bfb277 (patch) | |
| tree | 922b83ff764aa44305ef1c637ed63f08ecd2da3d /config/essentials/nvim/lua/user/cmp/setup.lua | |
| parent | e6b385e91a82645588af0fe2b3b9b4d74e6f4fdc (diff) | |
| parent | 148f3bfed154e393b388bb17faa10e165f008dc8 (diff) | |
Merge remote-tracking branch 'refs/remotes/origin/main'
Diffstat (limited to 'config/essentials/nvim/lua/user/cmp/setup.lua')
| -rw-r--r-- | config/essentials/nvim/lua/user/cmp/setup.lua | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/config/essentials/nvim/lua/user/cmp/setup.lua b/config/essentials/nvim/lua/user/cmp/setup.lua new file mode 100644 index 0000000..ed8a2d2 --- /dev/null +++ b/config/essentials/nvim/lua/user/cmp/setup.lua @@ -0,0 +1,49 @@ +local cmp = require'cmp' +cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(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-c>'] = cmp.mapping.abort(), + ['<C-y>'] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lua' }, + { name = 'nvim_lsp'}, + { name = 'path' }, + { name = 'luasnip' }, + { name = 'nvim_lsp_signature_help' }, + { name = 'buffer', keyword_length = 4 }, + }), + preselect = cmp.PreselectMode.None, +}) + +cmp.setup.filetype('gitcommit', { + sources = cmp.config.sources({ + { name = 'cmp_git' }, + { name = 'buffer', keyword_length = 4 }, + }) +}) + +cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer', keyword_length = 4 } + }, +}) +cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' }, + { name = 'cmdline', keyword_length = 4 } + }), +}) |
