The vim text editor is distributed with a very nice, but not well-known, less replacement which allows you to quickly and easily page through files or standard input, with full color syntax highlighting based on the type of the file. You don’t need to know how to use vi/vim to use this pager; the keybindings are similar to
less's (just hit
q to quit).
The “less.vim” pager in distribution had bugs and annoying quitting behavior that I fixed. I also made it work like
less -F by having it quit immediately after displaying, if the specified single file is less than a screenful. There’s no need to page something that’s less than one page, right?
Get the Goods
You can download from https://github.com/huyz/less.vim.
You can also continue to use
less by pre-processing the input with source-highlight.
- It can be set as $PAGER as it’s a complete replacement. It displays man pages, perldocs, and python documentation properly. It works on many systems including Cygwin. [↩]