Mon, 06 Mar 2023 10:42:32 -0600
more default editor switching
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 | }, | |
15 | opts = function() | |
16 | local cmp = require("cmp") | |
17 | return { | |
18 | completion = { | |
1054
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
19 | keyword_length = 3, |
1044 | 20 | }, |
1054
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
21 | formatting = { |
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
22 | format = function(entry, vim_item) |
1056 | 23 | if entry.source.name == "nvim_lsp_signature_help" then |
24 | vim_item.kind = "" | |
25 | elseif vim_item.kind == "Text" then | |
1054
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
26 | vim_item.kind = entry.source.name |
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
27 | end |
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
28 | return vim_item |
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
29 | end, |
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
30 | }, |
1044 | 31 | mapping = cmp.mapping.preset.insert({ |
32 | ["<C-b>"] = cmp.mapping.scroll_docs(-4), | |
33 | ["<C-f>"] = cmp.mapping.scroll_docs(4), | |
34 | ["<Tab>"] = cmp.mapping.select_next_item(), | |
35 | ["<S-Tab>"] = cmp.mapping.select_prev_item(), | |
36 | ["<C-g>"] = cmp.mapping.abort(), | |
1064 | 37 | ["<Right>"] = cmp.mapping.confirm({ select = true }), |
1044 | 38 | ["<Space>"] = function(fallback) |
39 | if cmp.visible() then | |
1064 | 40 | cmp.confirm({ select = false }, function() |
1044 | 41 | vim.api.nvim_feedkeys(" ", "n", false) |
42 | end) | |
43 | end | |
44 | fallback() | |
45 | end, | |
46 | }), | |
47 | sources = cmp.config.sources({ | |
48 | { name = "nvim_lsp" }, | |
49 | { name = "nvim_lsp_signature_help" }, | |
50 | { name = "nvim_lua" }, | |
1054
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
51 | { name = "buffer", option = { keyword_pattern = [[\k\+]] } }, |
1044 | 52 | { name = "path" }, |
1055
ba91fd3b81e1
completion fixes, but leave omni off
Meredith Howard <mhoward@roomag.org>
parents:
1054
diff
changeset
|
53 | -- { name = "omni" }, |
1044 | 54 | { name = "tags" }, |
1054
3a0ff0563a7b
tweak completion a little more
Meredith Howard <mhoward@roomag.org>
parents:
1044
diff
changeset
|
55 | { name = "calc" }, |
1044 | 56 | }), |
57 | } | |
58 | end, | |
59 | }, | |
60 | } |