Sunday, January 22, 2012

Re: How does work in gvim?

On 2012-01-22, Benjamin R. Haskell wrote:

> For an explanation: It seems to me that it's an accident of
> implementation. The Vim-internal key names I see mapped to nv_down
> (the function that implements moving downward some number of lines)
> in src/normal.c are:
>
> NL, Ctrl_M, Ctrl_N, '+', 'j', and K_DOWN
>
> In nv_down, the first thing it checks is whether MOD_MASK_SHIFT is
> set. In the comment, it indicates that it's checking for <S-Down>,
> which gets translated to "page down" (nv_page) rather than "line
> down".

Very good. I was looking for something more explicit in the code
and missed that.

> My guess is that GUI versions of Vim, where Enter != Shift-Enter, it
> also catches Shift + NL.
>
> It doesn't catch 'J' because that's a different function (nv_join).
> I'm not sure why it doesn't catch Ctrl_M, Ctrl_N, or '+'. Again,
> hypothesizing, probably because Ctrl+letter is already weird in Vim,
> so there's possibly special handling for it somewhere else (which
> doesn't pass Ctrl+Shift+letter to the function).
>
> 'Shift-+' is hard to type on QWERTY (where '+' already requires
> 'Shift'). But xmodmap'ing it to something without Shift, it still
> doesn't get caught.

If I use gvim, set the NumLk on my ThinkPad keyboard, and use the +
on the numeric keypad, + scrolls down one line and Shift-+ scrolls
down one page, as you thought it would.

Assuming that the behavior of Shift-Enter should be documented along
with <S-Up>, <PageUp> and CTRL-B, should the key combination be
spelled <S-Enter> or <S-CR>? The latter appears when typing Ctrl-K
Shift-Enter and either can be used on the lhs of a mapping.

I hesitate to document Shift-+ because it's not likely to be
encountered on the keyboards I'm familiar with and could be
difficult to explain. Maybe, "On keyboards where + is not already a
shifted key, Shift-+ will also scroll forward one page."

Regards,
Gary

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

No comments: