sponsor Vim development Vim logo Vim Book Ad

vimpager : Use ViM as PAGER

 script karma  Rating 377/154, Downloaded by 7167    Comments, bugs, improvements  Vim wiki

created by
Rafael Kitover
 
script type
utility
 
description
A slightly more sophisticated replacement for less.sh that also supports being set as the PAGER environment variable.
Displays man pages, perldocs and python documentation properly.
Works on Linux, Solaris, FreeBSD, NetBSD, OpenBSD, OSX, Cygwin and msys. Should work on most other systems as well.

On github:
http://github.com/rkitover/vimpager
 
install details
To use it as as your PAGER: put these in your ~/.bashrc or ~/.zshrc

    export PAGER=~/bin/vimpager
    alias less=$PAGER
    alias zless=$PAGER

To use a different vimrc with vimpager, put your settings into a
~/.vimpagerrc or ~/.vim/vimpagerrc or a file pointed to by the
VIMPAGER_RC environment variable.

You can also have a global config file for all users in /etc/vimpagerrc,
users can override it by creating a ~/.vimpagerrc or a
~/.vim/vimpagerrc.

To disable loading plugins, put "set noloadplugins" into a vimpagerrc
file.

You can also switch on the "vimpager" variable in your vimrc to set
alternate settings for vimpager.

Put the following into your .vimrc/vimpagerrc if you want to use
gvim/MacVim for your pager window:

    let vimpager_use_gvim = 1

To pass through text that is smaller than the terminal height (without
highlighting, at present) use this:

    let vimpager_passthrough = 1

To start vim with -X (no x11 connection, a bit faster startup) put the
following into your .vimrc/vimpagerrc:

    let vimpager_disable_x11 = 1

The scroll offset (:help scrolloff), may be specified by placing the
following into your .vimrc/vimpagerrc (default = 5, disable = 0):

    let vimpager_scrolloff = 5

The process tree of vimpager is available in the "vimpager_ptree"
variable, an example usage is as follows:

    if exists("vimpager")
      if exists("vimpager_ptree") && vimpager_ptree[-2] == 'wman'
        set ft=man
      endif
    endif

COMMAND LINE OPTIONS
====================

+ | +G
------

Start at the end of the file, just like less.

-c cmd
------

Run a vim command after opening the file.

CYGWIN NOTES
============

The Cygwin gvim is very buggy, vimpager works correctly with the native
Windows gvim, just put it in your PATH.

LICENSE AND COPYRIGHT
=====================

Copyright (c) 2013, Rafael Kitover rkitover@gmail.com

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vimpager 1.8.9 2014-05-25 7.0 Rafael Kitover * security enhancements (snordhausen: Stefan Nordhausen) #78
vimpager 1.8.8 2014-04-07 7.0 Rafael Kitover * don't clobber user's PATH (mayersj1: Steve Mayer)  #77
vimpager 1.8.7 2014-03-10 7.0 Rafael Kitover * use more lines for fallback man page detection, misc. code cleanups (eworm-de: Christian Hesse)
vimpager 1.8.6 2014-02-22 7.0 Rafael Kitover * allow _vimrc on non-windows (mortonfox: Morton Fox)
vimpager 1.8.5 2014-02-12 7.0 Rafael Kitover * fix up arrow binding again, broken in 1.8.4
vimpager 1.8.4 2014-02-09 7.0 Rafael Kitover * disable help screen 'h' binding, cursor moves left instead (Github issue #71)
vimpager 1.8.3 2013-12-23 7.0 Rafael Kitover * reexec self under bash or ksh when available, especially on Solaris (Github issue #63)
* add vim command -c option (aroig: Abdo Roig-Maranges)
* allow ~/.vim/vimpagerrc as conf file (lucc: Lucas Hoffmann)
vimpager 1.8.2 2013-04-26 7.0 Rafael Kitover * better man page detection heuristics, when detection by process tree fails
vimpager 1.8.1 2013-04-15 7.0 Rafael Kitover * License under 2-clause BSD (GitHub Issue #59)
vimpager 1.8.0 2013-03-20 7.0 Rafael Kitover * fix man detection on NetBSD (nonakap: NONAKA Kimihiro)
vimpager 1.7.8 2012-12-31 7.0 Rafael Kitover * set filetype for man pages correctly on FreeBSD (justinkb: Paul Mulders)
vimpager 1.7.7 2012-11-26 7.0 Rafael Kitover * fix screen flashing (GitHub Issue #46)
* fix q with visual selection (GitHub Issue #45)
* support for +G or + command line option to start at the end of the file (vincer: Vince Rosso)
vimpager 1.7.6 2012-11-13 7.0 Rafael Kitover * support /usr/local/etc/vimpagerrc and /etc/vimpagerrc, read after user's .vimrc
* fix for .vimrc paths with spaces (Github Issue #49)
* support compressed file extensions case-insensitively
vimpager 1.7.5 2012-09-29 7.0 Rafael Kitover * set nocp with -u, fixes Pathogen compatibility (Github Issue #40)
* delete temp directory if file is zero length
* remove .gz/.Z suffixes on temp files for compressed files
* support global config file /etc/vimpagerrc (eworm-de: Christian Hesse)
vimpager 1.7.4 2012-09-19 7.0 Rafael Kitover * improve $VIM detection for Win32 (cygwin/msys)
vimpager 1.7.3 2012-09-15 7.0 Rafael Kitover * fix usage without a vimrc (Github Issue #38) broken in 1.7.2
vimpager 1.7.2 2012-09-13 7.0 Rafael Kitover * passthrough option for small text (Wei Dai)
* major code refactor and cleanup
vimpager 1.7.1 2012-07-23 7.0 Rafael Kitover * fix arrow keys (Adam Lickel)
vimpager 1.7.0 2012-06-25 7.0 Rafael Kitover * make sure plugins don't override q (GitHub Issue #34)
* attempt fix for OpenBSD ps (GitHub Issue #33)
vimpager 1.6.9 2012-06-19 7.0 Rafael Kitover * stop sourcing vimrc/gvimrc twice (Dave Goodell)
vimpager 1.6.8 2012-04-11 7.0 Rafael Kitover * fix scrolloff and custom scrolloff setting (GitHub Issue #30)
* safe mode for temp directory (Anselm Strauss)
* turn off relative line numbers (Simon Olofsson and Anisse Astier)
vimpager 1.6.7 2012-01-29 7.0 Rafael Kitover * more intuitive arrow key behavior (patch by Iftekharul Haque)
* add vimpager_ptree variable to hold the process tree (patch by Wei Dai)
vimpager 1.6.6 2012-01-10 7.0 Rafael Kitover * fix malformed utf8 warnings
vimpager 1.6.5 2012-01-10 7.0 Rafael Kitover * fix "col: illegal byte sequence" errors
vimpager 1.6.4 2011-12-31 7.0 Rafael Kitover * configurable scrolloff by Peter Fern
vimpager 1.6.3 2011-12-09 7.0 Rafael Kitover * fix zero length check on cygwin
vimpager 1.6.2 2011-11-28 7.0 Rafael Kitover * Pathogen compatibility
* slightly faster startup
vimpager 1.6.1 2011-11-22 7.0 Rafael Kitover * only source .vimrc if it exists
vimpager 1.6.0 2011-11-18 7.0 Rafael Kitover * work around broken sed on OSX by using col -b if available
vimpager 1.5.9 2011-11-17 7.0 Rafael Kitover * remove -X by default (GitHub issue #19)
vimpager 1.5.8 2011-11-13 7.0 Rafael Kitover * re-source vimrc/gvimrc after less.vim to preserve user highlights and mappings
vimpager 1.5.7 2011-07-25 7.0 Rafael Kitover * remove mouse=h to allow mouse scrolling
vimpager 1.5.6 2011-07-17 7.0 Rafael Kitover * fix for filenames with spaces by Damien Pollet
vimpager 1.5.5 2011-06-30 7.0 Rafael Kitover * remove --noplugin
* better gvimrc detection on cygwin
vimpager 1.5.4 2011-06-24 7.0 Rafael Kitover * support ~/.vimpagerrc and VIMPAGER_RC
vimpager 1.5.3 2011-06-23 7.0 Rafael Kitover * exit immediately for zero length files
vimpager 1.5.2 2011-06-05 7.0 Rafael Kitover * turn off terminal reset on OSX
vimpager 1.5.1 2011-05-22 7.0 Rafael Kitover * better msys support
vimpager 1.5.0 2011-05-07 7.0 Rafael Kitover * set scrolloff-5
vimpager 1.4.9 2011-05-01 7.0 Rafael Kitover * trap more signals for temp file removal
* clear terminal on OSX only for terminal vim
vimpager 1.4.8 2011-04-22 7.0 Rafael Kitover * fix compatibility with Cygwin
* fix compatibility with Windows gvim in Cygwin and msys
* detect ssh session on OSX and Cygwin
* remove "Input not from a terminal" warning entirely
vimpager 1.4.7 2011-04-15 6.0 Rafael Kitover * fix some "input not from terminal" warnings
* fix for invocations on files not in current directory
vimpager 1.4.6 2011-04-11 6.0 Rafael Kitover * MacVim support
* override GUI colors from .gvimrc
* fix syntax highlighting for files opened directly
* reset terminal on completion
vimpager 1.4.5 2011-04-08 6.0 Rafael Kitover * fixes for Mac OSX
* -X option to speed up startup (jdevera)
vimpager 1.4.4 2011-03-21 6.0 Rafael Kitover * .vimrc option let vimpager_use_gvim = 1 to use gvim as the pager window
vimpager 1.4.3 2011-03-20 6.0 Rafael Kitover * Support for .Z and .gz files
vimpager 1.4.2 2011-03-20 6.0 Rafael Kitover * Extensive rewrite using awk for real Solaris compatibility by Wout Mertens.
* Filter ANSI color codes and backspaces for all pager invocations (github issue #2)
vimpager 1.4 2011-01-07 6.0 Rafael Kitover * fix for python2 docs on archlinux from Ivan S. Freitas
vimpager 1.3 2010-05-17 6.0 Rafael Kitover * added 'set nonu'
vimpager 1.2 2010-04-30 6.0 Rafael Kitover * fix for FreeBSD
* add esc-u mapping to turn off hlsearch
vimpager 1.1 2009-05-22 6.0 Rafael Kitover Fix bug where it wouldn't move on searches at launch without moving the cursor first
vimpager 1.0 2009-05-21 6.0 Rafael Kitover Fix for perldoc on Cygwin
vimpager 0.9 2009-05-19 6.0 Rafael Kitover Fix for filenames with spaces.
vimpager 0.8 2009-03-27 6.0 Rafael Kitover Turn off folds (correctly this time.)
ip used for rating: 54.224.225.86

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo