-- -- This file adds local changes to the corresponding file and plugins in LazyVim -- -- Pattern for plugin "echasnovski/mini.pairs": -- -- . all characters -- %a letters -- %c control characters -- %d digits -- %l lower case letters -- %p punctuation characters -- %s space characters -- %u upper case letters -- %w alphanumeric characters -- %x hexadecimal digits -- %z the character with representation 0 -- -- So below we try to say: -- NOT after alphanumeric, ), ], }, and not before alphanumeric, (, [, { local pattern = "[^%w\\%)%}%]][^%w\\%(%{%[]" -- An alternative can be: -- local pattern = "[%s\r][%s\n]" -- Which should say "only before or after whitespace" return { -- auto completion { -- https://github.com/hrsh7th/nvim-cmp "hrsh7th/nvim-cmp", opts = function(_, opts) local cmp = require("cmp") opts.completion = { completeopt = "menu,menuone,noselect", } opts.experimental = { ghost_text = false, } opts.mapping = vim.tbl_extend("force", opts.mapping, { --[""] = cmp.mapping.select_prev_item(), [""] = cmp.mapping.scroll_docs(-4), --[""] = cmp.mapping.select_next_item(), [""] = cmp.mapping.scroll_docs(4), --[""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.select_next_item(), --[""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.select_prev_item(), [""] = cmp.mapping({ i = function(fallback) if cmp.visible() then cmp.close() end fallback() end, }), [""] = cmp.mapping({ i = function(fallback) if cmp.visible() then cmp.close() end fallback() end, }), --[""] = cmp.mapping.complete(), --[""] = cmp.mapping.close(), --[""] = cmp.mapping.confirm { -- behavior = cmp.ConfirmBehavior.Insert, -- select = true, --}, [""] = cmp.mapping({ i = function(fallback) if cmp.visible() and cmp.get_active_entry() then cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }) else fallback() end end, s = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), }), [""] = cmp.mapping(function() if cmp.visible() then cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }) else cmp.complete() end end), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() elseif require("luasnip").expand_or_jumpable() then vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-expand-or-jump", true, true, true), "") else fallback() end end, { "i", "s", }), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() elseif require("luasnip").jumpable(-1) then vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-jump-prev", true, true, true), "") else fallback() end end, { "i", "s", }), }) end, }, -- snippets { -- https://github.com/echasnovski/L3MON4D3/LuaSnip "L3MON4D3/LuaSnip", }, -- auto pairs { -- https://github.com/echasnovski/mini.pairs "echasnovski/mini.pairs", opts = { mappings = { ["("] = { neigh_pattern = pattern }, ["["] = { neigh_pattern = pattern }, ["{"] = { neigh_pattern = pattern }, [")"] = { neigh_pattern = pattern }, ["]"] = { neigh_pattern = pattern }, ["}"] = { neigh_pattern = pattern }, ['"'] = { neigh_pattern = pattern }, ["'"] = { neigh_pattern = pattern }, ["`"] = { neigh_pattern = pattern }, }, }, }, -- Fast and feature-rich surround actions. For text that includes -- surrounding characters like brackets or quotes, this allows you -- to select the text inside, change or modify the surrounding characters, -- and more. { -- https://github.com/echasnovski/mini.surround "echasnovski/mini.surround", enabled = false, }, -- comments { -- https://github.com/JoosepAlviste/nvim-ts-context-commentstring "JoosepAlviste/nvim-ts-context-commentstring", enabled = false, }, { -- https://github.com/echasnovski/mini.comment "echasnovski/mini.comment", enabled = false, }, -- Better text-objects { -- https://github.com/echasnovski/mini.ai "echasnovski/mini.ai", enabled = false, }, }