local cmp = require("cmp") local luasnip = require("luasnip") cmp.setup({ snippet = { expand = function(args) luasnip.lsp_expand(args.body) -- For luasnip users end, }, sources = { { name = "luasnip" }, { name = "path" }, }, mapping = { [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() -- they way you will only jump inside the snippet region -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() elseif has_words_before() then cmp.complete() else fallback() end end, { "i", "s" }), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() elseif luasnip.jumpable(-1) then luasnip.jump(-1) else fallback() end end, { "i", "s" }), -- ... Your other mappings ... }, })