Quantcast

How to map (say) Ctrl-Shift-B

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to map (say) Ctrl-Shift-B

DubiousDude

In Vim's map command, <C-B> refers to control+B, while <S-B> refers to
Shift+B.
Is there a way to specify Ctrl-Shift-B?  What about other combinations
other
than Ctrl+Shift e.g. Alt ?

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to map (say) Ctrl-Shift-B

Tony Mechelynck

On 30/12/08 22:58, DubiousDude wrote:
> In Vim's map command,<C-B>  refers to control+B, while<S-B>  refers to
> Shift+B.
> Is there a way to specify Ctrl-Shift-B?  What about other combinations
> other
> than Ctrl+Shift e.g. Alt ?

IIUC, <S-B> -- or <S-b> -- is none other than B, i.e., capital B, which
you produce by hitting b with the Shift key depressed.

Ctrl-b and Ctrl-B are synonymous, they both mean 0x02. This cannot be
changed, it goes back to ASCII, which dates back to 7-hole paper tape
(not counting parity).

Alt-b and Alt-B are different, but here there's another hitch: Vim
represents the Alt modifier by setting the high bit (0x80), which means
that Alt-b (where b=0x62) is synonymous with â (small-a-circumflex,
0xE2) and that Alt-B (where B=0x42) is synonymous with Â
(capital-A-circumflex, 0xC2). Alt-Ctrl-B is 0x82 regardless of Shift,
since Ctrl-B is 0x02 regardless of Shift. In Latin1 0x82 is a
rarely-used control character but in Windows-1252 I think it is
printable, which means it might collide with some text character. In
Latin9 (aka ISO-8859-15) I think it's the same control character as in
Latin1 but I'm not sure.

For non-printable keys it is different: <F5> is the F5 key, <S-F5> is
Shift-F5, <C-F5> is Ctrl-F5, <A-F5> or <M-F5> is Alt-F5 (also known as
Meta-F5), <D-F5> is (on a Mac) Cmd-F5, <C-S-F5> is Ctrl-Shift-F5, etc.
Depending on your OS, it is possible that some of these combinations are
grabbed by the OS before they reach Vim: for instance, on my Linux
system with KDE winmanager, Alt-Fn and Ctrl-Fn are grabbed by the
windows manager and Ctrl-Alt-Fn is grabbed by the kernel, so gvim never
sees any of them. I can use Shift-Fn though.

See ":help keycodes", where these prefixes are near the end of the list.


Best regards,
Tony.
--
Valerie: Aww, Tom, you're going maudlin on me ...
Tom: I reserve the right to wax maudlin as I wane eloquent ...
                -- Tom Chapin

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Loading...