1 ---@type LazyPluginSpec
6 -- disable luasnip bindings for <tab> and <s-tab>
15 opts = function(_, opts)
16 local has_words_before = function()
17 unpack = unpack or table.unpack
18 local line, col = unpack(vim.api.nvim_win_get_cursor(0))
19 return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
22 local cmp = require("cmp")
23 local luasnip = require("luasnip")
25 opts.completion = vim.tbl_extend("force", opts.completion, {
26 completeopt = "menu,menuone,noselect",
28 --TODO: review if I want to keep any of LazyVim's mappings
29 opts.mapping = vim.tbl_extend("force", opts.mapping, {
30 ["<Tab>"] = cmp.mapping(function(fallback)
32 cmp.select_next_item()
33 elseif luasnip.expand_or_jumpable() then
34 luasnip.expand_or_jump()
35 elseif has_words_before() then
41 ["<S-Tab>"] = cmp.mapping(function(fallback)
43 cmp.select_prev_item()
44 elseif luasnip.jumpable(-1) then