diff options
Diffstat (limited to '.config/nvim/lua/user/plugins/cmp.lua')
| -rw-r--r-- | .config/nvim/lua/user/plugins/cmp.lua | 61 |
1 files changed, 41 insertions, 20 deletions
diff --git a/.config/nvim/lua/user/plugins/cmp.lua b/.config/nvim/lua/user/plugins/cmp.lua index 8776310..95ae6d5 100644 --- a/.config/nvim/lua/user/plugins/cmp.lua +++ b/.config/nvim/lua/user/plugins/cmp.lua @@ -1,24 +1,45 @@ return { - 'hrsh7th/nvim-cmp', - event = { 'InsertEnter', 'CmdlineEnter' }, - dependencies = { - 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-cmdline', - 'hrsh7th/cmp-path', - }, - opts = function() - local cmp = require('cmp') + 'hrsh7th/nvim-cmp', + event = { 'InsertEnter', 'CmdlineEnter' }, + dependencies = { + 'saadparwaiz1/cmp_luasnip', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-cmdline', + 'hrsh7th/cmp-path', + }, + opts = function() + local cmp = require('cmp') - return { - mapping = cmp.mapping.preset.insert(), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - }, { - { name = 'buffer' }, - }, { - { name = 'path' }, - }) - } - end, + return { + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert(), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = "luasnip" }, + }, { + { name = 'buffer' }, + }, { + { name = 'path' }, + }), + sorting = { + comparators = { + cmp.config.compare.offset, + cmp.config.compare.exact, + --cmp.config.compare.scopes, + cmp.config.compare.score, + cmp.config.compare.recently_used, + cmp.config.compare.locality, + cmp.config.compare.kind, + --cmp.config.compare.sort_text, + cmp.config.compare.length, + cmp.config.compare.order, + }, + }, + } + end, } |
