return { { "multicursor-nvim", event = "DeferredUIEnter", after = function(_) local mc = require("multicursor-nvim") mc.setup({ signs = false, }) -- Keybindings would be a lot better as local map = vim.keymap.set -- NOTE: this required for "repeatable" commands -- I'd like to use `2cn` for example (and that doesn't work out of box) local map_rep = function(modes, bind, action) map(modes, bind, function() for _ = 1, vim.v.count1, 1 do action() end end) end -- stylua: ignore start map({ "n", "x" }, "", function() mc.clearCursors() end) map({ "n", "x" }, "R", function() mc.restoreCursors() end) map_rep({ "n", "x" }, "j", function() mc.lineAddCursor(1) end) map_rep({ "n", "x" }, "k", function() mc.lineAddCursor(-1) end) map_rep({ "n", "x" }, "J", function() mc.lineSkipCursor(1) end) map_rep({ "n", "x" }, "K", function() mc.lineSkipCursor(-1) end) map_rep({ "n", "x" }, "cn", function() mc.matchAddCursor(1) end) map_rep({ "n", "x" }, "cN", function() mc.matchAddCursor(-1) end) map_rep({ "n", "x" }, "cs", function() mc.matchSkipCursor(1) end) map_rep({ "n", "x" }, "cS", function() mc.matchSkipCursor(-1) end) map({ "n", "x" }, "cM", mc.matchAllAddCursors) map("x", "m", mc.matchCursors) map("x", "s", mc.splitCursors) -- map("n", "g", mc.addCursorOperator) map({ "n", "x" }, "g", mc.operator) -- stylua: ignore end -- Customize how cursors look. local hl = vim.api.nvim_set_hl hl(0, "MultiCursorCursor", { reverse = true }) hl(0, "MultiCursorVisual", { link = "Visual" }) hl(0, "MultiCursorSign", { link = "SignColumn" }) hl(0, "MultiCursorMatchPreview", { link = "Search" }) hl(0, "MultiCursorDisabledCursor", { reverse = true }) hl(0, "MultiCursorDisabledVisual", { link = "Visual" }) hl(0, "MultiCursorDisabledSign", { link = "SignColumn" }) end, }, { "yanky.nvim", event = "DeferredUIEnter", after = function(_) require("yanky").setup({ highlight = { timer = 150 }, system_clipboard = { sync_with_ring = true, }, }) end, keys = { { "y", "(YankyYank)", mode = { "n", "x" }, desc = "Yank Text" }, { "p", "(YankyPutAfter)", mode = { "n", "x" }, desc = "Put Text After Cursor" }, { "P", "(YankyPutBefore)", mode = { "n", "x" }, desc = "Put Text Before Cursor" }, { "gp", "(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put Text After Selection" }, { "gP", "(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put Text Before Selection" }, { "[y", "(YankyCycleForward)", desc = "Cycle Forward Through Yank History" }, { "]y", "(YankyCycleBackward)", desc = "Cycle Backward Through Yank History" }, { "]p", "(YankyPutIndentAfterLinewise)", desc = "Put Indented After Cursor (Linewise)" }, { "[p", "(YankyPutIndentBeforeLinewise)", desc = "Put Indented Before Cursor (Linewise)" }, { "]P", "(YankyPutIndentAfterLinewise)", desc = "Put Indented After Cursor (Linewise)" }, { "[P", "(YankyPutIndentBeforeLinewise)", desc = "Put Indented Before Cursor (Linewise)" }, { ">p", "(YankyPutIndentAfterShiftRight)", desc = "Put and Indent Right" }, { "(YankyPutIndentAfterShiftLeft)", desc = "Put and Indent Left" }, { ">P", "(YankyPutIndentBeforeShiftRight)", desc = "Put Before and Indent Right" }, { "(YankyPutIndentBeforeShiftLeft)", desc = "Put Before and Indent Left" }, { "=p", "(YankyPutAfterFilter)", desc = "Put After Applying a Filter" }, { "=P", "(YankyPutBeforeFilter)", desc = "Put Before Applying a Filter" }, }, }, { "which-key.nvim", event = "DeferredUIEnter", after = function(_) require("which-key").setup() require("which-key").add({ { "s", group = "search" }, { mode = { "n", "v" }, { "g", group = "git" }, { "gh", group = "hunk" }, { "S", group = "surround" }, }, }) end, }, { "oil.nvim", -- NOTE: lazy loading is not recommended -- event = "DeferredUIEnter", after = function(_) require("oil").setup() end, keys = { { "-", "Oil", { desc = "Open parent directory" } }, }, }, }