How to fix the shifted function keys in vim in xterm in gnome-terminal?

view full story

http://unix.stackexchange.com – When I hit the <s-f2> key to execute my nnoremap <s-f2> :set number! mapping Vim opens its "Insert" mode above (O) and types the 1;2Q string. In order to see the entire terminal key code – not eaten up half-way by the "Normal" mode – I hit <c-v><s-f2> in "Insert" mode and get ^[O1;2Q, where ^[ is the <esc> character. Because I don't understand why the ^[O1;2Q terminal key code is not mapped to the <s-f1> Vim code I defined the following function in my ~/.vimrc file: function! s:Mod_fix_shift_fkey() let a=0 let b='PQRS' while a < 4 (HowTos)