I am, just starting to use Kakoune, which I find a great editor.
I am on Debian,GNU/Linux, kakoune v. 2019.01.20.
The problems happens when I use kak in a urxvt terminal, while not with gnome-terminal.
I have no problem to map function keys form F5 to F12, but when I try to use mappings of, e.g., F2 I get, if in insert mode, 12~ printed. (Typing in the terminal cat F2 yields ^[[12~ ). This happens for functions keys F1, F2, F3 and F4.
What is $TERM set to? Inside gnome-terminal, it should be vte-256color (or possibly xterm-256color), while inside urxvt it should be rxvt-unicode-256color.
Most modern terminals try to behave the same way as xterm, and so set $TERM to xterm or xterm-256color for compatibility. urxvt is one of the few modern terminals that is deliberately incompatible with xterm, and one of the biggest differences is in the way it handles function keys, so make sure $TERM is set to some kind of rxvt-related name.