A “less”-like pager with color syntax highlighting

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.


There is an alternate fork of less.vim called vimpager which seems to have some other nice features1, but it doesn’t fix the core problems in “less.vim”.  I may integrate the two sets of changes.

You can also continue to use less by pre-processing the input with source-highlight.


  1. 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. []
This entry was posted in vim and tagged , , , , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.