I have set vim to be my default reader for program like less and I have rebind some of the key of my vim via .vimrc.

Unfortunately, less doesn't pick them up. I have trying setting the keybinds system wide via /etc/vimrc but it doesn't work.

How can I get all programs using vim as a pager to use my custom keybinds?

  • AFAIK it is not possible, less is a pager not a text editor.
    – statox
    May 27, 2016 at 10:02
  • 4
    Note sure if this helps you, but muru has some experience dealing with this and wrote a nice blog post here: cse.iitb.ac.in/~murukesh/2015/08/28/vim-for-man.html . Alternatively, you could look at something like github.com/rkitover/vimpager
    – cbaumhardt
    May 27, 2016 at 11:20
  • 1
    Why do you even expect less to use your vimrc?
    – romainl
    May 27, 2016 at 11:59
  • Are we talking about this? When talking about other tools/programs could you make sure we are all on the same page by posting a link?
    – Tumbler41
    May 27, 2016 at 14:52

1 Answer 1


While viewing text in less, you can press v to view the text in $VISUAL or $EDITOR. If you want to change the keys for less, you can use lesskey. But, it's not available on OS X without compiling less yourself or installing it from homebrew.

As pointed out in the question's comments, there are plugins and environment variables that can change the pager program. However, I mainly wanted to answer this question to point something out to new users who are enthusiastic about having Vim all over the place: You really don't want Vim to be your pager.

You want your pager to be fast, and less is fast at displaying text. It's fast because it only loads as many lines as there are in your terminal session. You can open up a giant text file with less and it will appear instantly in most cases. You're not going to be able to jump to the bottom of a 20GB text file with less, but you'll at least be able to briefly regret the decision and quit quickly.

Compared to less, Vim is not fast. Vim loads the entire text into memory. If you're unlucky, Vim will also find a matching syntax file for what's loaded and you'll be stuck waiting for the text to be highlighted. On top of that, you might hit the wrong keys and cause Vim to re-indent a giant text file. Optimistically, you'll be waiting a minute, but most likely, the process will have to be killed. Sure, you can make Vim run in read-only mode, but that only keeps you from saving the file. Vim can still do things very slowly to the text that's loaded.

Vim is a great text editor, but it's not good for all text-related activities.

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.