On Fri, Feb 18, 2011 at 05:35:38AM -0800, Philippe Vaucher wrote: > FWIW, you have my vote for making this happen. I think it's not that > hard to make everyone happy on this subject by the mean of .vimrc > settings, like we have between vi and vim for :set compatible.
:set compatible does suggest the possibility for more similar options,
ways to optionally extend the featureset beyond its existing capability,
without upsetting people who rely on the current behaviour, limits and
all.
> Wether we use structures or the byte 80 for special key is
> implementation detail, I mean wether macros, mappings or registers
> simply store a list of bytes or a list of structures shouldn't change
> anything: you just need an explicit mapping between a displayed
> keypress and a byte or a struct (<S-Up> can map internally to \x80\xFD
> \xAA or { 1, MOD_SHIFT, KEY_UP } and it shouldn't matter).
>
> Structures just look more sane as they're more generic/expressive and
> accurate about the problem, they also are easier to expand on.
Another thought occurs to me: UTF-8 sequences vs. Alt keys.
I don't know if it's an accident of implementation, but I have never
been able to get them all working. Lets consider this example
é is U+00e9 in Unicode, encodes to two UTF-8 bytes C3 A9
C is U+0043 in Unicode, encodes to one UTF-8 byte 43
If vim simply uses an 8th-bit-high to indicate Alt+ prefix on simple
ASCII, then what does
C3
mean? Is it the first of two UTF-8 bytes, or is it Alt+C ?
Alternatively, perhaps we'll represent it as a two-byte sequence with an
<Escape> prefix. Now we've conflated someone typing <Escape> C from
someone typing Alt+C. Again, in the 1970s that may be what it was, but
these days it's far from clear from GUIs, that this behaviour is what's
wanted. Again, a simple 'set' option should default this:
:set noaltisescape (defaults to :set altisescape)
The reason I suggested a simple neat orthogonal structure representation
is that it can disambiguate all of the following cases in a clear
logical way; a way that can be easily fed from GUI events, and fed into
map tables or other internals.
Tab { 1, 0, KEY_TAB }
Ctrl-I { 0, MOD_CTRL, 'i' }
Ctrl-Shift-I { 0, MOD_CTRL, 'I' }
Escape C { 1, 0, KEY_ESCAPE }, { 0, 0, 'C' }
Alt+C { 0, MOD_ALT, 'C' }
é { 0, 0, 0xe9 }
--
Paul "LeoNerd" Evans
[email protected]
ICQ# 4135350 | Registered Linux# 179460
http://www.leonerd.org.uk/
signature.asc
Description: Digital signature
