Paul LeoNerd Evans wrote:
> On Mon, 09 Jun 2008 17:41:00 +0200
> Bram Moolenaar <[EMAIL PROTECTED]> wrote:
>
> > > In that case, I'd like to hear your suggestion on how I may use
> > > combinations of Shift/Ctrl/Alt with keypresses in a normal vim.
> >
> > Nothing special, most of them can be recognized already. Especially if
> > you are using an xterm. Try ":set term=xterm" and then ":set termcap".
> > The entries which contain ";*" recognize modifier keys. For other
> > terminals you will need to add the termcap entries somehow.
>
> Yes; that works on real vim-in-xterm. But what of e.g. screen? When I'm
> editing an email in mutt, running via screen, this uses vim. vim starts
> up with $TERM=screen, not xterm, so doesn't know to do that.
>
> Perhaps to handle this case, vim ought always to recognise the ;* entries?
No, because only a few terminals send these codes. Instead, add the
entries in the termcap/terminfo. That might break other programs
though. You can also use a Vim script to set them. Or a shell wrapper
around Vim. All that works but isn't nice.
> > > Currently, the only way I find that works at all is to keep a giant list
> > > of :map and :map! commands, which recognise the sequences. See the
> > > attached file.
> > >
> > > This sortof works; it's enough to get things like Ctrl-LR to be move word
> > > left/right, Alt+arrow to be move focus to window, and Alt+[number] to
> > > be :b1 to :b10.
> > >
> > > It doesn't work in paste mode, and it upsets the ttytime settings.
> > >
> > > Also, it breaks UTF-8 input if I try to map Alt+letter.
> >
> > Alt-letter is supposed to work to get the letter with the 8th bit set.
> > Then converted to whatever encoding you are using. This is how vi
> > traditionally works, in combination with traditional terminals (and
> > terminal emulators).
> >
> > Also note that things like <Esc>0 should never be produced by a single
> > key, since it should mean <Esc> (leave Insert mode), and zero (go to
> > first column). Relying on timing is not a good idea.
>
> I'm aware of the problems with timing :)
>
> Seems we're stuck though, ultimately.. we can't make all three of
> <Esc>letter, <Alt-letter> and UTF-8 work.
>
> > > If you know of a better way to make all these things possible, I would
> > > very much like to hear it.
> >
> > It appears you need to read :help xterm-modifier-keys
>
> Again, I'm aware of it. I'm aware that it doesn't apply during screen.
>
> How would you recommend I make vim-in-screen work, then? Just set
> TERM=xterm or some vim-specific fiddling if it notices $TERM == screen ?
>
>
> I still think ultimately a rethink of the bottom input layer is best
> here... I can make it not break anything that currently works... Read
> terminfo just as before - it'll still JustWork on your 1970s glass
> teletype that sends Weird Sequences. It'll just happen to work better on
> a modern xterm. And as a side-effect, GDK and other input layers will
> work better.
>
> I'm still failing to understand your hostility toward it.
I know the current termcap/terminfo system is outdated and insufficient
for modern terminal emulaters. The solution should be changing
termcap/terminfo into some better library. The actual escape sequences
used can remain the same.
GUIs already have a way to handle arbitrary key presses. Unfortunately,
they are very complicated to use. Especially when it comes to handling
different keyboard layouts. Look in the Vim GUI code to see what's done
there, it's far from nice.
--
Far back in the mists of ancient time, in the great and glorious days of the
former Galactic Empire, life was wild, rich and largely tax free.
Mighty starships plied their way between exotic suns, seeking adventure and
reward among the furthest reaches of Galactic space. In those days, spirits
were brave, the stakes were high, men were real men, women were real women
and small furry creatures from Alpha Centauri were real small furry creatures
from Alpha Centauri. And all dared to brave unknown terrors, to do mighty
deeds, to boldly split infinitives that no man had split before -- and thus
was the Empire forged.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
/// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---