|
1 | 1 | {
|
2 |
| - plugins.cmp = { |
3 |
| - enable = true; |
4 |
| - autoEnableSources = true; |
| 2 | + plugins = { |
| 3 | + cmp-emoji = { enable = true; }; |
| 4 | + cmp = { |
| 5 | + enable = true; |
| 6 | + settings = { |
| 7 | + autoEnableSources = true; |
| 8 | + experimental = { ghost_text = true; }; |
| 9 | + performance = { |
| 10 | + debounce = 60; |
| 11 | + fetchingTimeout = 200; |
| 12 | + maxViewEntries = 30; |
| 13 | + }; |
| 14 | + snippet = { expand = "luasnip"; }; |
| 15 | + formatting = { fields = [ "kind" "abbr" "menu" ]; }; |
| 16 | + sources = [ |
| 17 | + { name = "nvim_lsp"; } |
| 18 | + { name = "emoji"; } |
| 19 | + { |
| 20 | + name = "buffer"; # text within current buffer |
| 21 | + option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; |
| 22 | + keywordLength = 3; |
| 23 | + } |
| 24 | + { name = "copilot"; } |
| 25 | + { |
| 26 | + name = "path"; # file system paths |
| 27 | + keywordLength = 3; |
| 28 | + } |
| 29 | + { |
| 30 | + name = "luasnip"; # snippets |
| 31 | + keywordLength = 3; |
| 32 | + } |
| 33 | + ]; |
| 34 | + |
| 35 | + window = { |
| 36 | + completion = { border = "solid"; }; |
| 37 | + documentation = { border = "solid"; }; |
| 38 | + }; |
| 39 | + |
| 40 | + mapping = { |
| 41 | + "<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; |
| 42 | + "<C-j>" = "cmp.mapping.select_next_item()"; |
| 43 | + "<C-k>" = "cmp.mapping.select_prev_item()"; |
| 44 | + "<C-e>" = "cmp.mapping.abort()"; |
| 45 | + "<C-b>" = "cmp.mapping.scroll_docs(-4)"; |
| 46 | + "<C-f>" = "cmp.mapping.scroll_docs(4)"; |
| 47 | + "<C-Space>" = "cmp.mapping.complete()"; |
| 48 | + "<CR>" = "cmp.mapping.confirm({ select = true })"; |
| 49 | + "<S-CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })"; |
| 50 | + }; |
| 51 | + }; |
| 52 | + }; |
| 53 | + cmp-nvim-lsp = { enable = true; }; # lsp |
| 54 | + cmp-buffer = { enable = true; }; |
| 55 | + cmp-path = { enable = true; }; # file system paths |
| 56 | + cmp_luasnip = { enable = true; }; # snippets |
| 57 | + cmp-cmdline = { enable = false; }; # autocomplete for cmdline |
5 | 58 | };
|
6 |
| - |
7 |
| - plugins.cmp-buffer.enable = true; |
| 59 | + extraConfigLua = '' |
| 60 | + luasnip = require("luasnip") |
| 61 | + kind_icons = { |
| 62 | + Text = "", |
| 63 | + Method = "", |
| 64 | + Function = "", |
| 65 | + Constructor = "", |
| 66 | + Field = "", |
| 67 | + Variable = "", |
| 68 | + Class = "", |
| 69 | + Interface = "", |
| 70 | + Module = "", |
| 71 | + Property = "", |
| 72 | + Unit = "", |
| 73 | + Value = "", |
| 74 | + Enum = "", |
| 75 | + Keyword = "", |
| 76 | + Snippet = "", |
| 77 | + Color = "", |
| 78 | + File = "", |
| 79 | + Reference = "", |
| 80 | + Folder = "", |
| 81 | + EnumMember = "", |
| 82 | + Constant = "", |
| 83 | + Struct = "", |
| 84 | + Event = "", |
| 85 | + Operator = "", |
| 86 | + TypeParameter = "", |
| 87 | + } |
| 88 | +
|
| 89 | + local cmp = require'cmp' |
| 90 | +
|
| 91 | + -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). |
| 92 | + cmp.setup.cmdline({'/', "?" }, { |
| 93 | + sources = { |
| 94 | + { name = 'buffer' } |
| 95 | + } |
| 96 | + }) |
| 97 | +
|
| 98 | + -- Set configuration for specific filetype. |
| 99 | + cmp.setup.filetype('gitcommit', { |
| 100 | + sources = cmp.config.sources({ |
| 101 | + { name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it. |
| 102 | + }, { |
| 103 | + { name = 'buffer' }, |
| 104 | + }) |
| 105 | + }) |
| 106 | +
|
| 107 | + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). |
| 108 | + cmp.setup.cmdline(':', { |
| 109 | + sources = cmp.config.sources({ |
| 110 | + { name = 'path' } |
| 111 | + }, { |
| 112 | + { name = 'cmdline' } |
| 113 | + }), |
| 114 | + -- formatting = { |
| 115 | + -- format = function(_, vim_item) |
| 116 | + -- vim_item.kind = cmdIcons[vim_item.kind] or "FOO" |
| 117 | + -- return vim_item |
| 118 | + -- end |
| 119 | + -- } |
| 120 | + }) ''; |
8 | 121 | }
|
0 commit comments