1 ---@type LazyPluginSpec
6 -- disable luasnip bindings for <tab> and <s-tab>
15 ---@param opts cmp.ConfigSchema
16 opts = function(_, opts)
17 local has_words_before = function()
18 unpack = unpack or table.unpack
19 local line, col = unpack(vim.api.nvim_win_get_cursor(0))
20 return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
23 local cmp = require("cmp")
24 local luasnip = require("luasnip")
26 opts.completion = vim.tbl_extend("force", opts.completion, {
27 completeopt = "menu,menuone,noselect",
29 --TODO: review if I want to keep any of LazyVim's mappings
30 opts.mapping = vim.tbl_extend("force", opts.mapping, {
31 ["<Tab>"] = cmp.mapping(function(fallback)
33 cmp.select_next_item()
34 elseif luasnip.expand_or_jumpable() then
35 luasnip.expand_or_jump()
36 elseif has_words_before() then
42 ["<S-Tab>"] = cmp.mapping(function(fallback)
44 cmp.select_prev_item()
45 elseif luasnip.jumpable(-1) then
57 "echasnovski/mini.pairs",
62 "echasnovski/mini.surround",
64 { "S", "<cmd><C-u>lua MiniSurround.add('visual')<cr>", "x" },
65 { "yss", "ys_", remap = true },
69 -- TODO: this is tpope/surround like, but should consider using vim-sandwich mappings
70 -- see: :h MiniSurround-vim-surround-config