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?
Hello
Yes it’s possible as described at the bottom of this wiki page : https://github.com/mawww/kakoune/wiki/Normal-mode-commands#suggestions
# 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"
else
echo "exec ${kak_count}0"
fi
}}
1 Like
define-command zero -params 1 %{ %sh{
Shouldn’t that be eval %sh{ ... }
rather than just %sh{ ... }
?
1 Like