Tuesday, September 22, 2015

Re: How to map SPACE to :next at "Press ENTER" prompt?

On Wed, Sep 23, 2015 at 3:17 AM, Tony Mechelynck
<antoine.mechelynck@gmail.com> wrote:
> On Tue, Sep 22, 2015 at 10:10 PM, Aleksey Tsalolikhin
> <atsaloli.tech@gmail.com> wrote:
>> Hello,
>>
>> Background: I am editing multiple files and I would like to move to the next
>> file (:next) after running a command that leaves me at the "Press ENTER or
>> type command to continue" prompt. I can do this by typing
>>
>> :next
>>
>> but I would like to use a keymapping to make it faster. (I'm actually
>> teaching a five day class and I'm showing a lot of files in vim, a sort of
>> "vim slideshow" if you will).
>>
>> My .vimrc contains:
>>
>> map <SPACE> :next<CR>
>>
>> and this works while I'm editing a file, but if after I run a command, I get
>> the "Press ENTER or type command to continue" prompt, and when I press SPACE
>> there, vim pops me back in the edit buffer FOR THAT SAME FILE.
>>
>> How can I make the mapping of SPACE to :next effective at the "Press ENTER"
>> prompt?
>>
>> I read :help mapmode and tried the following but alas they all have the same
>> behavior as "map" (pop me back in the same file):
>>
>> omap <SPACE> :next<CR>
>> nmap <SPACE> :next<CR>
>> vmap <SPACE> :next<CR>
>> cmap <SPACE> :next<CR>
>> imap <SPACE> :next<CR>
>>
>> Best,
>> Aleksey
>>
>
> IIUC, hitting the space bar at the more-prompt or hit-enter-prompt
> (qq.v.) triggers Vim's pagination behaviour (and gobbles up the
> <Space> keystroke) before it reaches the point where mappings are
> expanded.
>
> Try with a different key: I recommend some F key, for instance with
> :map <F5> :next<CR>
> :map <S-F5> :prev<CR>

P.S. English-speaking people are fond of Latin abbreviations. "qq.v."
is for any one of "quos vide / quas vide / quae vide" which is the
plural of "q.v." (quem vide / quam vide / quod vide) and therefore
Latin for, er, "которые види(те)" IIUC.

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.

No comments:

Post a Comment