1 ---@type LazyPluginSpec
6 -- disable luasnip bindings for <tab> and <s-tab>
11 require("luasnip.loaders.from_snipmate").lazy_load()
23 ---@param opts cmp.ConfigSchema
24 opts = function(_, opts)
25 local has_words_before = function()
26 unpack = unpack or table.unpack
27 local line, col = unpack(vim.api.nvim_win_get_cursor(0))
28 return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
31 local cmp = require("cmp")
32 local luasnip = require("luasnip")
34 opts.completion = vim.tbl_extend("force", opts.completion, {
35 completeopt = "menu,menuone,noselect",
37 --TODO: review if I want to keep any of LazyVim's mappings
38 opts.mapping = vim.tbl_extend("force", opts.mapping, {
39 ["<Tab>"] = cmp.mapping(function(fallback)
41 cmp.select_next_item()
42 elseif luasnip.expand_or_jumpable() then
43 luasnip.expand_or_jump()
44 elseif has_words_before() then
50 ["<S-Tab>"] = cmp.mapping(function(fallback)
52 cmp.select_prev_item()
53 elseif luasnip.jumpable(-1) then
65 "echasnovski/mini.pairs",
70 "echasnovski/mini.surround",
72 { "S", "<cmd><C-u>lua MiniSurround.add('visual')<cr>", "x" },
73 { "yss", "ys_", remap = true },
77 -- TODO: this is tpope/surround like, but should consider using vim-sandwich mappings
78 -- see: :h MiniSurround-vim-surround-config