Re: ctrl+shift key mappings

2006-05-18 Thread Eric Arnold

Thanks. Now I've got some good multi-bytes to multi-chew on :-)


On 5/18/06, A.J.Mechelynck [EMAIL PROTECTED] wrote:

Eric Arnold wrote:
 Hey.  Do you know any simple key sequence to test whether code I'm
 adding to Vim is handling mbytes correctly?  Unfortunately, even if I
 got Japanese installed, I've forgotten the few Kanji I knew  :-P




   if termencoding == 
 let termencoding = encoding
   endif
   set encoding=utf-8
   setglobal bomb
   enew

then set Insert mode and start adding characters. See
:help i_CTRL-V_digit
:help ga
:help g8

If you want a sample UTF-8 file with various multibyte characters in it,
you may download my front page
http://users.skynet.be/antoine.mechelynck/index.htm (browse to it with
any browser then File - Save As or similar).


Best regards,
Tony.

P.S. For that kind of questions, it is usually better to send them to
the list (so everyone can reply) rather than privately to one person.



ctrl+shift key mappings

2006-05-17 Thread Jared
Ok, this will be my last question for the night (promise!).  I'd like to map
separate commands to Ctrl-C and Ctrl-Shift-C.  I've tried a couple different
ways to do it, but this one seems like it should be most correct:

vnoremap C-c +y
vnoremap C-S-c ^Gol+y

What's happening, though, is that the C-S-c map overwrites the C-c map.  If
I were to place C-c below C-S-c in .vimrc, the it'd be the other way around.

So, two questions: 1) Am I defining the C-S-c mapping correctly?  I
believe that's how it's done, but I couldn't find a specific example in the
docs.  2) How do I make Vim distinguish between the two commands?

Actually, I also have a 3rd, pseudo-related question:  How do I include a
control key sequence in a map?  I'm using ^G in the above example, but that
seems to be completely ignored when I hit C-S-c.  I also tried C-g, but
that's also ignored.

Thanks once again.  Believe me when I say that I'm most appreciative of the
help that's constantly offered on this mailing list.

--
Jared


Re: ctrl+shift key mappings

2006-05-17 Thread A.J.Mechelynck

Jared wrote:

Ok, this will be my last question for the night (promise!).  I'd like to map
separate commands to Ctrl-C and Ctrl-Shift-C.  I've tried a couple different
ways to do it, but this one seems like it should be most correct:

vnoremap C-c +y
vnoremap C-S-c ^Gol+y

What's happening, though, is that the C-S-c map overwrites the C-c map.  If
I were to place C-c below C-S-c in .vimrc, the it'd be the other way around.

So, two questions: 1) Am I defining the C-S-c mapping correctly?  I
believe that's how it's done, but I couldn't find a specific example in the
docs.  2) How do I make Vim distinguish between the two commands?

Actually, I also have a 3rd, pseudo-related question:  How do I include a
control key sequence in a map?  I'm using ^G in the above example, but that
seems to be completely ignored when I hit C-S-c.  I also tried C-g, but
that's also ignored.

Thanks once again.  Believe me when I say that I'm most appreciative of the
help that's constantly offered on this mailing list.

--
Jared


  
You're out of luck there: Ctrl-Shift-C and Ctrl-C both correspond to 
0x03, Vim cannot tell them apart. Similarly for Ctrl + any letter key 
with or without Shift. Vim _can_ distinguish, let's say, Ctrl-F5 and 
Ctrl-Shift-F5 because those are represented differently in its input 
stream. Provided of course that a window manager doesn't intercept those 
key sequences before Vim has a chance to see them (mine does :-( ).


You ought to be able to include C-G (or C-g) in a mapping, see 
:help  for examples. But of course if that mapping is overridden by 
another with identical (or equivalent) {lhs}, you won't see it.



Best regards,
Tony.


Re: ctrl+shift key mappings

2006-05-17 Thread Eric Arnold

On 5/17/06, Jared [EMAIL PROTECTED] wrote:

Ok, this will be my last question for the night (promise!).  I'd like to map
separate commands to Ctrl-C and Ctrl-Shift-C.  I've tried a couple different
ways to do it, but this one seems like it should be most correct:

vnoremap C-c +y
vnoremap C-S-c ^Gol+y


Sorry, but I don't think there is a shift-control-c.  This is [partly]
because control chars are treated as a single byte, whereas other
keyboard keys, like arrows, etc, are treated as 3-6 byte strings where
the extra modifiers like shit/control/meta are in another byte.



What's happening, though, is that the C-S-c map overwrites the C-c map.  If
I were to place C-c below C-S-c in .vimrc, the it'd be the other way around.

So, two questions: 1) Am I defining the C-S-c mapping correctly?  I
believe that's how it's done, but I couldn't find a specific example in the
docs.  2) How do I make Vim distinguish between the two commands?

Actually, I also have a 3rd, pseudo-related question:  How do I include a
control key sequence in a map?  I'm using ^G in the above example, but that
seems to be completely ignored when I hit C-S-c.  I also tried C-g, but
that's also ignored.



c-g is the correct method.  Something else must be happening.


Thanks once again.  Believe me when I say that I'm most appreciative of the
help that's constantly offered on this mailing list.

--
Jared