local M = {} local function tidy_lhs(lhs) -- nvim_buf_get_keymap replaces leading "<" with "" e.g. "CTRL-v>" lhs = lhs:gsub("^", "<") -- shorten ctrls if lhs:lower():match "^$", "LM>") :gsub("RightMouse>$", "RM>") :gsub("MiddleMouse>$", "MM>") :gsub("ScrollWheelDown>$", "SD>") :gsub("ScrollWheelUp>$", "SU>") :gsub("ScrollWheelLeft>$", "SL>") :gsub("ScrollWheelRight>$", "SR>") end -- sort lhs roughly as per :help index local PAT_MOUSE = "^<.*Mouse" local PAT_CTRL = "^