summaryrefslogtreecommitdiff
path: root/lua/completions.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/completions.lua')
-rw-r--r--lua/completions.lua53
1 files changed, 53 insertions, 0 deletions
diff --git a/lua/completions.lua b/lua/completions.lua
new file mode 100644
index 0000000..bd90178
--- /dev/null
+++ b/lua/completions.lua
@@ -0,0 +1,53 @@
1local cmp = require 'cmp'
2
3cmp.setup({
4 snippet = {
5 expand = function(args) end,
6 },
7 mapping = {
8 ['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
9 ['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
10 ['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
11 ['<C-y>'] = cmp.config.disable,
12 ['<C-e>'] = cmp.mapping({
13 i = cmp.mapping.abort(),
14 c = cmp.mapping.close(),
15 }),
16 ['<CR>'] = cmp.mapping.confirm({ select = true }),
17
18 ['<C-n>'] = cmp.mapping(function(fallback)
19 if cmp.visible() then
20 cmp.select_next_item()
21 else
22 fallback()
23 end
24 end, { 'i', 's', 'c' }),
25
26 ['<C-p>'] = cmp.mapping(function(fallback)
27 if cmp.visible() then
28 cmp.select_prev_item()
29 else
30 fallback()
31 end
32 end, { 'i', 's', 'c' }),
33 },
34 sources = cmp.config.sources({
35 { name = 'nvim_lsp' },
36 }, {
37 { name = 'buffer' },
38 })
39})
40
41cmp.setup.cmdline('/', {
42 sources = {
43 { name = 'buffer' }
44 }
45})
46
47cmp.setup.cmdline(':', {
48 sources = cmp.config.sources({
49 { name = 'path' }
50 }, {
51 { name = 'cmdline' }
52 })
53})