Thu, 16 Mar 2023 12:30:54 -0500
Cleaner conflict resolution
1044 | 1 | return { |
2 | { | |
3 | "hrsh7th/nvim-cmp", | |
4 | event = "InsertEnter", | |
5 | dependencies = { | |
6 | "hrsh7th/cmp-buffer", | |
7 | "hrsh7th/cmp-calc", | |
8 | "hrsh7th/cmp-nvim-lsp", | |
9 | "hrsh7th/cmp-nvim-lsp-signature-help", | |
10 | "hrsh7th/cmp-nvim-lua", | |
11 | "hrsh7th/cmp-omni", | |
12 | "hrsh7th/cmp-path", | |
13 | "quangnguyen30192/cmp-nvim-tags", | |
14 | }, | |
1070
72b613de1102
disable lsp preselect
Meredith Howard <mhoward@roomag.org>
parents:
1064
diff
changeset
|
15 | config = function() |
1044 | 16 | local cmp = require("cmp") |
1070
72b613de1102
disable lsp preselect
Meredith Howard <mhoward@roomag.org>
parents:
1064
diff
changeset
|
17 | cmp.setup({ |
72b613de1102
disable lsp preselect
Meredith Howard <mhoward@roomag.org>
parents:
1064
diff
changeset
|
18 | preselect = cmp.PreselectMode.None, |
1044 | 19 | completion = { |
1054
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
20 | keyword_length = 3, |
1044 | 21 | }, |
1054
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
22 | formatting = { |
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
23 | format = function(entry, vim_item) |
1056 | 24 | if entry.source.name == "nvim_lsp_signature_help" then |
25 | vim_item.kind = "" | |
26 | elseif vim_item.kind == "Text" then | |
1054
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
27 | vim_item.kind = entry.source.name |
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
28 | end |
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
29 | return vim_item |
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
30 | end, |
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
31 | }, |
1044 | 32 | mapping = cmp.mapping.preset.insert({ |
33 | ["<C-b>"] = cmp.mapping.scroll_docs(-4), | |
34 | ["<C-f>"] = cmp.mapping.scroll_docs(4), | |
35 | ["<Tab>"] = cmp.mapping.select_next_item(), | |
36 | ["<S-Tab>"] = cmp.mapping.select_prev_item(), | |
37 | ["<C-g>"] = cmp.mapping.abort(), | |
1064 | 38 | ["<Right>"] = cmp.mapping.confirm({ select = true }), |
1071
e76020af023d
add explicit begin-completion bind
Meredith Howard <mhoward@roomag.org>
parents:
1070
diff
changeset
|
39 | ["<C-Space>"] = cmp.mapping.complete(), |
1044 | 40 | ["<Space>"] = function(fallback) |
41 | if cmp.visible() then | |
1064 | 42 | cmp.confirm({ select = false }, function() |
1044 | 43 | vim.api.nvim_feedkeys(" ", "n", false) |
44 | end) | |
45 | end | |
46 | fallback() | |
47 | end, | |
48 | }), | |
49 | sources = cmp.config.sources({ | |
50 | { name = "nvim_lsp" }, | |
51 | { name = "nvim_lsp_signature_help" }, | |
52 | { name = "nvim_lua" }, | |
1054
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
53 | { name = "buffer", option = { keyword_pattern = [[\k\+]] } }, |
1044 | 54 | { name = "path" }, |
1055
ba91fd3b81e1
completion fixes, but leave omni off
Meredith Howard <mhoward@roomag.org>
parents:
1054
diff
changeset
|
55 | -- { name = "omni" }, |
1044 | 56 | { name = "tags" }, |
1054
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
57 | { name = "calc" }, |
1044 | 58 | }), |
1070
72b613de1102
disable lsp preselect
Meredith Howard <mhoward@roomag.org>
parents:
1064
diff
changeset
|
59 | }) |
1044 | 60 | end, |
61 | }, | |
62 | } |