Does anyone know how to bind function keys in zsh? I want to be able to use function keys in programs running in my terminal, not bind them to some function in zsh. I've tried putting bindkey "\e[OP" key_f1 in .zshrc but I get No such widget `key_f1' when I try that. Suggestions?
To explicitly assign a key to itself use
bindkey "\e[OP" self-insert
To unbound a key, use
bindkey -r "\e[OP"
To get the symbols for a specific key you can simply use
cat Enter F1 produces in my terminal (URxVT) the following string:
^[OP. This can vary depending on the terminal, especially for combinations like Ctrl+↑
But concerning your specific problem: I doubt, that
zsh is the reason that the functions key do not work in your program, because when the program is running,
zsh should not capture any keys. I think it's more probably, that the program itself does not understand the symbols the terminal sends to it. So, you could try another terminal (
xterm worked in most such cases for me). If that failes to, you probably have to check the keyboard mapping of the X server (
~/.Xmodmap in Linux, I unfortunately don't where to tune OSX...)