From b4251c5e9533450ba06227a19fad4aec1a4f6f60 Mon Sep 17 00:00:00 2001 From: Mora Unie Youer Date: Tue, 7 Oct 2025 14:40:54 +0300 Subject: fix: `multicursor.nvim` now supports counts --- lua/config/plugins/extra.lua | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'lua/config/plugins/extra.lua') diff --git a/lua/config/plugins/extra.lua b/lua/config/plugins/extra.lua index bc5cbd1..19a7042 100644 --- a/lua/config/plugins/extra.lua +++ b/lua/config/plugins/extra.lua @@ -11,29 +11,19 @@ return { -- 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({ "n", "x" }, "j", function() mc.lineAddCursor(1) end) + map({ "n", "x" }, "k", function() mc.lineAddCursor(-1) end) + map({ "n", "x" }, "J", function() mc.lineSkipCursor(1) end) + map({ "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" }, "cn", function() mc.matchAddCursor(1) end) + map({ "n", "x" }, "cN", function() mc.matchAddCursor(-1) end) + map({ "n", "x" }, "cs", function() mc.matchSkipCursor(1) end) + map({ "n", "x" }, "cS", function() mc.matchSkipCursor(-1) end) map({ "n", "x" }, "cM", mc.matchAllAddCursors) map("x", "m", mc.matchCursors) map("x", "s", mc.splitCursors) -- cgit v1.2.3-70-g09d2