diff options
| author | Kyren223 <ulmliad223@gmail.com> | 2024-08-06 16:19:31 +0300 |
|---|---|---|
| committer | Kyren223 <ulmliad223@gmail.com> | 2024-08-06 16:19:31 +0300 |
| commit | 46335ce5edb504e1653e140e037f15be104e81db (patch) | |
| tree | 26ecfa1104a7e00675e1bab27c894cda69ec31cf /.config/nvim/lua/custom/config/cmp.lua | |
| parent | 03a5e641f0347a37627e9d1ef2627f331bb6d82f (diff) | |
feat(nvim): clangd_extensions for lsp
Diffstat (limited to '.config/nvim/lua/custom/config/cmp.lua')
| -rw-r--r-- | .config/nvim/lua/custom/config/cmp.lua | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/.config/nvim/lua/custom/config/cmp.lua b/.config/nvim/lua/custom/config/cmp.lua index 127f7b3..e8f3166 100644 --- a/.config/nvim/lua/custom/config/cmp.lua +++ b/.config/nvim/lua/custom/config/cmp.lua @@ -1,4 +1,4 @@ --- Load snippets +-- Load cmp_opts for _, ft_path in ipairs(vim.api.nvim_get_runtime_file('lua/custom/snippets/*.lua', true)) do loadfile(ft_path)() end @@ -36,10 +36,10 @@ cmp.setup({ enabled = is_enabled, completion = { completeopt = 'menu,menuone,noinsert' }, sources = cmp.config.sources({ - { name = 'nvim_lsp' }, -- for lsp - { name = 'luasnip' }, -- for snippets + { name = 'nvim_lsp' }, -- for lsp + { name = 'luasnip' }, -- for snippets { name = 'lazydev', group_index = 0 }, -- for lazydev.nvim - { name = 'path' }, -- for filesystem + { name = 'path' }, -- for filesystem }, {}), snippet = { expand = function(args) @@ -55,6 +55,18 @@ cmp.setup({ side_padding = 0, }, }, + sorting = { + comparators = { + cmp.config.compare.offset, + cmp.config.compare.exact, + cmp.config.compare.recently_used, + require('clangd_extensions.cmp_scores'), + cmp.config.compare.kind, + cmp.config.compare.sort_text, + cmp.config.compare.length, + cmp.config.compare.order, + }, + }, mapping = cmp.mapping.preset.insert({ ['<Tab>'] = snippet_jump(1), ['<S-Tab>'] = snippet_jump(-1), @@ -72,7 +84,7 @@ cmp.setup({ format = function(entry, vim_item) local kind = lspkind.cmp_format({ mode = 'symbol_text', maxwidth = 50 })(entry, vim_item) local strings = vim.split(kind.kind, '%s', { trimempty = true }) - kind.kind = ' ' .. (strings[1] or '') .. ' ' -- left (icon) + kind.kind = ' ' .. (strings[1] or '') .. ' ' -- left (icon) kind.menu = ' ' .. (strings[2] or '') .. '' -- right (text) return kind end, |
