From cc897121a97d834d34b892f0b8806d816cea65c3 Mon Sep 17 00:00:00 2001 From: "Wansmer (Ivan Smirnov)" Date: Sat, 14 Sep 2024 11:17:12 +0300 Subject: [PATCH] feat: add `feed_with_count` method --- lua/langmapper/utils.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/langmapper/utils.lua b/lua/langmapper/utils.lua index f9996df..4d26147 100644 --- a/lua/langmapper/utils.lua +++ b/lua/langmapper/utils.lua @@ -171,6 +171,12 @@ function M.trans_list(list) return trans_list end +function M.feed_with_count(keys) + local modes = { 'c', 'o', 'i' } -- ignore count on this modes + local count = (vim.v.count == 0 or vim.tbl_contains(modes, vim.fn.mode())) and '' or vim.v.count + return count .. keys +end + ---Remapping each CTRL+ sequence function M._map_translated_ctrls() local function remap_ctrl(list, from, to)