Map global normal 0 (any number key mapping) vs. repeat count param

A mapping like map global normal 0 Gh unfortunately conflicts with the “type number before command to do thing N times” system. Is it possible to somehow avoid the conflict and have 0 do my mapping when I haven’t typed any numbers, but ignore the mapping when I am typing numbers already and there’s the param= thing in the corner?


Yes it’s possible as described at the bottom of this wiki page :

# if you press 0 alone, it will echo "foo".
# if you press 0 after a number to express a count, like 10, it will work as usual.
map global normal 0 ':zero "echo foo"<ret>'
define-command zero -params 1 %{ %sh{
  if [ $kak_count = 0 ]; then
    echo "$1"
    echo "exec ${kak_count}0"
1 Like

define-command zero -params 1 %{ %sh{

Shouldn’t that be eval %sh{ ... } rather than just %sh{ ... }?

1 Like