First off, I'm aware that I can use Alt+1 (through 9 and 0) to synthesize the respective function keys (F1 through F10) in Midnight Commander. It has helped me many times, but by default I still press the actual function keys intuitively.
Gist: I'm trying to run both Vim and Midnight Commander inside a
tmux session (sometimes window, sometimes pane), using PuTTY.
So by default I have the following PuTTY configuration:
The problem now when mapping (
map <F1> :tab help<CR>, and also
imap) F1 in Vim, is that it gives the effect of ~ (toggle case). And indeed if I press F1 through F5 in the shell, the tilde (
~) is the result, along with a bell.
The function keys work perfectly fine in Midnight Commander, though, using this setting.
There is one odd thing about the above setting in addition to my problems with F1: I also "mapped" F5 (
set pastetoggle=<F5>) in Vim. Strangely enough that works like a charm, even though the F5 key on the shell gives a
~ just like F1 etc.
Note: when running Vim outside of
tmux, the default binding (and my override) of F1 work fine!
With "Linux" mapping
So naturally I tried to use the "Linux" setting in the dialog above. So when I press F1 Vim goes into insert mode at the end of the line (effect of A). Midnight Commander doesn't recognize any of the function keys with this setting. Sure enough on the shell F1 gives me
A and a bell (F2 a
B and so on).
What am I missing here? How can I get a uniform behavior where both Midnight Commander and Vim will recognize the function keys?
Remote system is Ubuntu 14.04 with
TERM is set to
TERM=xterm outside the
tmux session and
TERM=screen when seen from inside a pane or window.
I am not using:
set-option -g default-terminal "screen-256color"
to override the terminal type inside