Wednesday, May 18, 2016

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

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
>
> --
> --
> 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:

Post a Comment