X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/b23eb3955580e2de13c03bf59169ccd2b2009d33..fdd63454b51a35418ec23d3489cf20ae66a2299d:/nvim/lua/plugins/coding.lua diff --git a/nvim/lua/plugins/coding.lua b/nvim/lua/plugins/coding.lua index 7bf442f..131fc4a 100644 --- a/nvim/lua/plugins/coding.lua +++ b/nvim/lua/plugins/coding.lua @@ -9,6 +9,7 @@ return { "honza/vim-snippets", config = function() require("luasnip.loaders.from_snipmate").lazy_load() + require("luasnip.loaders.from_lua").load({ paths = vim.fn.stdpath("config") .. "/lua/snippets" }) end, }, }, @@ -23,6 +24,14 @@ return { -- auto completion { "hrsh7th/nvim-cmp", + version = false, -- last release is way too old + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "saadparwaiz1/cmp_luasnip", + }, ---@param opts cmp.ConfigSchema opts = function(_, opts) local has_words_before = function() @@ -51,7 +60,7 @@ return { completeopt = "menu,menuone,noselect", }) -- TODO: review if I want to keep any of LazyVim's mappings - opts.mapping = cmp.mapping.preset.insert({ + opts.mapping = { -- lazyvims [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), @@ -80,7 +89,7 @@ return { fallback() end end, { "i", "s" }), - }) + } end, }, @@ -92,10 +101,16 @@ return { -- surround { "echasnovski/mini.surround", - keys = { - { "S", "lua MiniSurround.add('visual')", "x" }, - { "yss", "ys_", remap = true }, - }, + keys = function() + -- HACK: use function to disable merging with LazyVim's keys definition + return { + { "ys", desc = "Add surrounding", "n" }, + { "S", desc = "Add surrounding", "x" }, + { "ds", desc = "Delete surrounding" }, + { "cs", desc = "Change surrounding" }, + { "yss", "ys_", remap = true }, + } + end, opts = { mappings = { -- TODO: this is tpope/surround like, but should consider using vim-sandwich mappings @@ -109,6 +124,12 @@ return { update_n_lines = "", }, }, + config = function(_, opts) + require("mini.surround").setup(opts) + -- remap visual + vim.keymap.del("x", "ys", { silent = true }) + vim.keymap.set("x", "S", [[:lua MiniSurround.add('visual')]], { silent = true }) + end, }, -- comments {