2

I really like how the less pager uses w to scroll up and z to scroll down since they are single keys, in vim I have to use CTRL+d/CTRL+f to get the same effect. Having to hold ctrl is a bit of a nuisance.

Of course I could just remap the scroll keys, but that might break plugins, generate bad karma, etc, etc...

Is there a single key shortcut to move down by a screen already? Your suggestions?

4

If you are not a member of the clan of arrow keys haters, and if your distribution provider didn't screw up your termcap / terminfo database, the PgUp and PgDown keys should work just fine. And so would Home and End, Insert and Delete, and even the arrow keys, both in insert, normal, select, visual, and Ex modes (and whatever else Vim has in store that I can't remember just now).

On the other hand, if you are a member of said clan, you'll have to stop listening to the filthy arrow keys propaganda and just get used to the One True Way of Ctrl-d and Ctrl-f.

  • 1
    Just for completeness. I decided to go with this in my vimrc: nnoremap <Up> 10k and nnoremap <Down> 10j seem to work nicely. – user10607 Jul 11 '15 at 14:39
  • 1
    IMHO, you should have mapped those keys to ctrl-u and and cltr-d, respectively. Then you could set scroll=10 to have a similar behavior. – Vitor Jul 12 '15 at 15:57
4

Most of the "single key" shortcuts are used for the more important and useful editing operations. Pagers don't have this problem, since they are by definition viewers, so they have all single keys available for buffer presentation.

But, in read-only Vim buffers (e.g. when reading a help topic), it may make sense to locally re-assign some of keys. If you place the following lines in your .vimrc, you will remap d, u and q in read-only buffers to scroll down a page, scroll up a page or quit, respectively:

augroup vimrc
    autocmd!
    autocmd BufEnter * call s:check_readonly()
augroup END

function! s:check_readonly()
    if &readonly
        nnoremap <buffer> d <PageDown>
        nnoremap <buffer> u <PageUp>
        nnoremap <buffer> q :q<cr>
    endif
endfunction

Reference: this and vim's help system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.