Saturday, August 13, 2011

Re: Where to map tnext tprev

On 11/08/11 09:47, Dmitry Teslenko wrote:
> 2011/8/10 Tony Mechelynck<antoine.mechelynck@gmail.com>:
>> On 10/08/11 09:34, Dmitry Teslenko wrote:
>>
>> 2) My favourite keys to assign to the {lhs} of _any_ mapping are<F2> to
>> <F12> (with the exception of<F10> if it is used to trigger the System
>> menu), and<S-F1> to<S-F12>. If you don't have enough with those 22 keys,
>> use a few of them as prefixes for longer {lhs}es for mappings which you
>> won't need too often. AFAIK those F keys (other than unshifted F1 = Help and
>> sometimes unshifted F10 = Menu) aren't used for anything else, and, when
>> used with no modifier or with only Shift, they are reliably passed to Vim on
>> all platforms and all terminals.
>>
> Thanks for advice!
>
> Sadly, all platfroms and all terminals don't include:
> 1) linux ttys (as in kubuntu 11.04 distro)
> 2) kde konsole terminal (unless configured to use xfree 4 input profile)
>
> in both cases vim dont catch function keys with shift/control modifiers
>

Oh? Let me see what happens on openSUSE Linux 11.4...

In the Linux tty (e.g. /dev/tty4), Vim sees some Shift-Fn keys but not
others:

nothing Shift
F1 <Esc>[[A <Esc>[25~
F2 <Esc>[[B <Esc>[26~
F3 <Esc>[[C <Esc>[28~
F4 <Esc>[[D <Esc>[29~
F5 <Esc>[[E <Esc>[31~
F6 <Esc>[17~ <Esc>[32~
F7 <Esc>[18~ <Esc>[33~
F8 <Esc>[19~ <Esc>[34~
F9 <Esc>[20~
F10 <Esc>[21~
F11 <Esc>[23~
F12 <Esc>[24~

IOW it sees F1-F8 with or without Shift, F9-F12 only without. (Ctrl-Fn
is used there as synonymous of Ctrl-Alt-Fn, to switch virtual displays,
so Vim doesn't see them.). Now let's try konsole:

nothing Shift
F1 <Esc>OP
F2 <Esc>OQ <Esc>O2Q
F3 <Esc>OR <Esc>O2R
F4 <Esc>OS <Esc>O2S
F5 <Esc>[15~ <Esc>[15;2~
F6 <Esc>[17~ <Esc>[17;2~
F7 <Esc>[18~ <Esc>[18;2~
F8 <Esc>[19~ <Esc>[19;2~
F9 <Esc>[20~ <Esc>[20;2~
F10 <Esc>[21~ <Esc>[21;2~
F11 <Esc>[23~ <Esc>[23;2~
F12 <Esc>[24~ <Esc>[24;2~

Here Vim gets them all except Shift-F1; and by using Ctrl-K instead of
Ctrl-V as prefix I can see that it is correctly set up to identify them
too. What profile is my konsole configured to use? Hmm... "Default
(XFree4)".

Gvim, of course, sees them all (F1-F12 with or without Shift. OTOH,
Ctrl- and Alt-Fn seem to be snatched by the windowmanager). Well, that's
still 19 distinct keypresses that I can use in all the instances of Vim
or gvim that I use, and if someday I need more, I can use multikey
mappings. To see what you can use, some experimentation may be useful.


Best regards,
Tony.
--
The economy depends about as much on economists as the weather does on
weather forecasters.
-- Jean-Paul Kauffmann

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: