I have been trying to use Keymando to create mappings to simulate Vim "normal mode" by holding down the Ctrl key. I have an array with a bunch of hashes (vim_num_commands) representing mappings, and I was running them through some code (see below) in an attempt to do the mappings in my keymandorc. Reloading the keymandorc with this code resulted in Keymando instantly quitting with no error message, then refusing to start again (again with no error message). Commenting out the code would allow Keymando to start normally.
vim_num_commands.each do |cmd|
(1..5).each do |n|
trigger = case cmd[:trigger]
when String then default_trigger_proc.call(n, cmd[:trigger])
when Proc then cmd[:trigger].call(n)
end
action = cmd[:action].call(n)
map trigger, action
end
end
I did some experimenting to see what was the problem, and I was able to isolate it to ranges. Even this code causes the same issue:
(1..5).each do |n| end
In fact, simply putting
(1..5)
by itself on a line causes the same problem. By changing (1..5) in my original code to [1, 2, 3, 4, 5] I was able to get all of my mappings to load perfectly fine. But this seemingly arbitrary hatred of ranges led me to waste a lot of time! Please fix.