Friday, May 20, 2016

Re: How to set CTRL and minus as a key mapping?

2016-05-20 23:03 GMT+03:00 Tony Mechelynck <antoine.mechelynck@gmail.com>:
> On Wed, May 18, 2016 at 4:48 PM, Nikolay Aleksandrovich Pavlov
> <zyx.vim@gmail.com> wrote:
>> 2016-05-18 14:08 GMT+03:00 Igor Forca <igor2x@gmail.com>:
>>> Hi,
>>> I really like to use big fonts in my gVim 7.4 on Windows 7. But time to time I would like to have smaller font size, to actually see bigger picture (without need to move up or down).
>>>
>>> In this case I would like to create key mapping CTRL and minus to shrink font and CTRL and plus to set it back to normal. Something very similar is used in a lot of programs like in Firefox (to zoom up/down).
>>>
>>> What I have figure it out I can set the following:
>>> nnoremap <C-x> <Esc>:set guifont=Consolas:h9:cDEFAULT<CR>
>>> nnoremap <C-y> <Esc>:set guifont=Consolas:h15:cDEFAULT<CR>
>>>
>>> and works fine, but instead of C-x and C-y I would like to set C-- and C-+
>>> like:
>>> nnoremap <C--> <Esc>:set guifont=Consolas:h9:cDEFAULT<CR>
>>> nnoremap <C-+> <Esc>:set guifont=Consolas:h15:cDEFAULT<CR>
>>>
>>> But when pressing CTRL and minus nothing happens, the same with CTRL and plus.
>>> It looks like there is something else going on. How to debug this problem? How to map "CTRL and minus" and "CTRL and plus" to above setting?
>>
>> You cannot use modifiers with any non-ASCII character and some of the
>> ASCII ones: namely those that do not live in range 0x40 .. 0x5F: i.e.
>> from `@` to underscore; . The single exception are special keys like
>> F1..F12, arrows, etc. So `<C-->` is probably `<C-_>`, but `<C-+>` will
>> not work, this is by design (problem is internal representation of
>> those keys and legacy from the days when Vi supported ASCII-only
>> terminals, modern terminal emulators *still* not supporting more key
>> combinations makes this issue even harder because it narrows down a
>> number of people who need this fixed; strange, but `:echo "\<C-+>"`
>> yields something which looks like special internal representation of
>> `<C-+>`, but still this key combo is not going to work). Neovim has
>> wider support of such key combinations, but AFAIR its Windows build is
>> still experimental (and I do not know about GUI).
>>
>>>
>>> Thanks
>>>
>
>
>
> What might work is to use Alt instead of Ctrl. The usual result
> (depending on your terminal settings) is that Alt sets the 0x80 bit on

OP mentions gVim. So terminal settings are not involved. Do not know
how `<A-` is encoded there, but `:echo "\<A-t>"` producing U+00F4
(note: *not* 0xF4 byte) (&encoding is utf-8) suggests that it would be
again handled in a strange fashion.

> printable keys, so that <A--> maps to 0xAD or U+00AD which is (in
> Latin1 and in UTF-8) the soft-hyphen, and <A-+> maps to 0xAB or U+00AB

0xAD byte is *not* U+00AD in UTF-8. U+00AD in UTF-8 is 0xC2 0xAD. Same
for U+00AB.

> which is the opening French quote. AFAIK neither of these collides
> with anything useful in Normal mode, but in Insert mode your text
> writing habits may (or may not) call for soft-hypens and/or French
> quotes.
>
> Best regards,
> Tony.
>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: