@@ -52,35 +52,41 @@ return {
52
52
end ,
53
53
},
54
54
55
+ sorting = {
56
+ priority_weight = 10.0 ,
57
+ comparators = {
58
+ cmp .config .compare .score , -- based on : score = score + ((#sources - (source_index - 1)) * sorting.priority_weight)
59
+ cmp .config .compare .locality ,
60
+ cmp .config .compare .recently_used ,
61
+ cmp .config .compare .offset ,
62
+ cmp .config .compare .order ,
63
+ -- cmp.config.compare.kind,
64
+ -- compare.exact,
65
+ -- compare.scopes, -- what?
66
+ -- compare.sort_text,
67
+ -- compare.length, -- useless
68
+ -- compare.score_offset, -- not good at all
69
+ },
70
+ },
71
+
55
72
formatting = {
56
73
fields = { ' kind' , ' abbr' },
57
74
-- fields = { 'kind', 'abbr', 'menu' },
58
- expandable_indicator = true ,
59
- format = function (entry , vim_item )
60
- if vim .tbl_contains ({ ' path' }, entry .source .name ) then
61
- local icon , hl_group = require (' nvim-web-devicons' ).get_icon (entry :completion_item ().label )
62
- if icon then
63
- vim_item .kind = icon
64
- vim_item .kind_hl_group = hl_group
65
- return vim_item
66
- end
67
- end
68
- return require (' lspkind' ).cmp_format {
69
- with_text = false ,
70
- -- ellipsis_char = '...',
71
- maxwidth = 30 ,
72
- maxHeight = 18 ,
73
- }(entry , vim_item )
74
- end ,
75
- -- format = require('lspkind').cmp_format {
76
- -- mode = 'symbol_text',
77
- -- maxwidth = 180,
78
- -- maxHeight = 90,
79
- -- ellipsis_char = '...',
80
- -- symbol_map = {
81
- -- Copilot = '',
82
- -- },
83
- -- },
75
+ expandable_indicator = false ,
76
+ format = require (' lspkind' ).cmp_format {
77
+ mode = ' symbol' ,
78
+ preset = ' codicons' ,
79
+ -- mode = 'symbol_text',
80
+ maxwidth = {
81
+ abbr = 30 ,
82
+ menu = 0 ,
83
+ },
84
+ maxHeight = 18 ,
85
+ ellipsis_char = ' ...' ,
86
+ symbol_map = {
87
+ Copilot = ' ' ,
88
+ },
89
+ },
84
90
},
85
91
experimental = {
86
92
ghost_text = true ,
@@ -120,12 +126,15 @@ return {
120
126
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
121
127
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
122
128
},
123
- sources = {
124
- { name = ' nvim_lsp' },
125
- { name = ' copilot' },
126
- { name = ' path' , max_item_count = 7 }, -- file system paths
127
- { name = ' buffer' , max_item_count = 7 }, -- text within current buffer
128
- { name = ' luasnip' , max_item_count = 7 }, -- snippets
129
+ sources = cmp .config .sources {
130
+ { name = ' copilot' , priority = 10 },
131
+ { name = ' nvim_lsp' , priority = 9 },
132
+ { name = ' buffer' , priority = 8 , max_item_count = 7 }, -- text within current buffer
133
+ { name = ' luasnip' , priority = 7 , max_item_count = 7 }, -- snippets
134
+ { name = ' path' , priority = 6 , max_item_count = 7 }, -- file system paths
135
+ { name = ' spell' , keyword_length = 3 , priority = 5 , keyword_pattern = [[ \w\+]] },
136
+ { name = ' nerdfont' , priority = 3 },
137
+ { name = ' calc' , priority = 3 },
129
138
{
130
139
name = ' lazydev' ,
131
140
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
0 commit comments