2

I'm very new to vim and found bindings Ctrl-F for page down and Ctrl-B for page up kind of inconvenient. I intuitively try to page up with Ctrl-F and page down with Ctrl-B because F is higher than B.

QUESTION: Is there a way to swap this two combinations?

0

1 Answer 1

9

Yes. You can change just about anything you want to change in Vim. Just do

nnoremap <C-f> <C-b>
nnoremap <C-b> <C-f>

Add those two mappings in your vimrc file and you've both of those commands swapped.

nnoremap - Maps new key combinations to existing commands without affecting any other commands that might be using the original command.

The mnemonic for me is,

f - forward
b - backward

So, whenever I want to go forward in the page, I press Ctrl + F and Ctrl + B for going backward.

3
  • Its not just something I use. It is probably how the command was intended to be remembered as. Sep 24, 2016 at 8:47
  • There are other ways to move around in the file; the keys ^F and ^B move forward and backward a page, keeping a couple of lines of continuity between screens so that it is possible to read through a file using these rather than ^Dand ^U if you wish.
    – KCCole
    Dec 3, 2017 at 20:04
  • This is from Bill Joy's original paper on vi.
    – KCCole
    Dec 3, 2017 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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