Control-Tab and Control-Space in console vim

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Control-Tab and Control-Space in console vim

David Brewster-2
Hi
Why is it that it's so hard/impossible to get Control-Tab and Control-Space key
mappings set up in console vim, but not in gvim ? I'm using vim in a
cygwin bash/rxvt console.

David

Reply | Threaded
Open this post in threaded view
|

Re: Control-Tab and Control-Space in console vim

Bugzilla from peterp@stack.nl
Op donderdag 3 november 2005 11:29, schreef David Brewster:
> Hi
> Why is it that it's so hard/impossible to get Control-Tab and Control-Space
> key mappings set up in console vim, but not in gvim ? I'm using vim in a
> cygwin bash/rxvt console.

Well, I don't know about Control-Space (which inserts the last inserted text),
but Control-Tab in a console is just not possible, because a Tab character is
actually a Control-I. So Control-Tab would be Control-Control-I, which is
actually just Control-I

Peter
Reply | Threaded
Open this post in threaded view
|

Re: Control-Tab and Control-Space in console vim

John (Eljay) Love-Jensen
In reply to this post by David Brewster-2
Hi David,

> Why is it that it's so hard/impossible to get Control-Tab and Control-Space
key mappings set up in console vim, but not in gvim ? I'm using vim in a cygwin
bash/rxvt console.

In gVim (at least with most GUIs), the operating system passes an keydown,
keypress, keyrepeat, and keyup events to the application.

It'll be something like this:
Raw Key Pressed:  #9 (Tab key)
Cooked Value Sequence:  0x09 (tab character)
Modifier Keys Down (aka bucky bits):
  + Left Shift
  - Right Shift
  + Left Control
  - Right Control
  - Meta
  - Left Option
  - Right Option
  - Alt (or Left Alt)
  - AltGr (or Right Alt)
  - Caps Lock
  - Num Lock
  - Scroll Lock

The GUI app can do lots of fancy stuff with that kind of information.
Someone can press the left shift, left control and tab key concurrently, and
the application could do something tricky with such a chorded key
combination.

A CLI app (command line interface; or a console application) does not get
all that information.  This is what a console app sees for the same chorded
keys:

stdin:  0x09

The CLI app does not see the keydown or keyup events.  The CLI app only gets
the cooked values from the keypress and keyrepeat events, passed in through
stdin, without the bucky bits at its disposal.

So a CLI app is often at a disadvantage when it comes to doing tricky stuff.

Now a CLI app could be written to interact with the hardware at a low level,
and get all those same keys.  But such kind of ad hackery is very platform
specific / not portable, brittle (from OS to OS version), and hard to
maintain (because it usually involves some deep voodoo).

HTH,
--Eljay

bucky bits: http://catb.org/~esr/jargon/html/B/bucky-bits.html