• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

autoload/H23-Jun-2020-2,9572,650

debian/H23-Jun-2020-385273

inc/H23-Jun-2020-223174

macros/H23-Jun-2020-719600

markdown/H23-Jun-2020-602415

markdown_src/H23-Jun-2020-547365

plugin/H23-Jun-2020-745653

prototypes/H23-Jun-2020-967540

scripts/H23-Jun-2020-725474

syntax/H23-Jun-2020-519451

test/H23-Jun-2020-1,5831,203

.gitignoreH A D23-Jun-2020441 4035

.mailmapH A D23-Jun-2020140 32

.travis.ymlH A D23-Jun-2020223 138

ChangeLog_vimcat.ymlH A D23-Jun-20202.1 KiB6150

ChangeLog_vimpager.ymlH A D23-Jun-20209.3 KiB276213

DOC_AUTHORS.ymlH A D23-Jun-2020118 54

DockerfileH A D23-Jun-2020225 98

LICENSEH A D23-Jun-20208.4 KiB162150

MakefileH A D23-Jun-202011.9 KiB310269

PKGBUILDH A D23-Jun-2020651 2420

README.mdH A D23-Jun-202014.4 KiB492345

TODO.ymlH A D23-Jun-20201.1 KiB3027

vimcatH A D23-Jun-20209.6 KiB392318

vimpagerH A D23-Jun-202030.6 KiB1,040773

vimpagerrcH A D23-Jun-2020332 75

README.md

1[![Join the chat at https://gitter.im/vimpager/Lobby](https://badges.gitter.im/vimpager/Lobby.svg)](https://gitter.im/vimpager/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2<!-- START doctoc generated TOC please keep comment here to allow auto update -->
3<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
4### Vimpager User Manual
5
6- [NAME](#name)
7- [SYNOPSIS](#synopsis)
8- [RUN-TIME DEPENDENCIES](#run-time-dependencies)
9- [BUILD DEPENDENCIES](#build-dependencies)
10- [INSTALL](#install)
11- [PATHOGEN INSTALLATION](#pathogen-installation)
12- [DESCRIPTION](#description)
13- [USING FROM VIM](#using-from-vim)
14- [COMMAND LINE OPTIONS](#command-line-options)
15  - [-h | --help | --usage](#-h----help----usage)
16  - [-v | --version](#-v----version)
17  - [+ | +G](#--g)
18  - [+F](#f)
19  - [-N | --LINE-NUMBERS](#-n----line-numbers)
20  - [-c cmd](#-c-cmd)
21  - [--cmd cmd](#--cmd-cmd)
22  - [-u vimrc](#-u-vimrc)
23  - [-s](#-s)
24  - [--passthrough](#--passthrough)
25  - [--force-passthrough](#--force-passthrough)
26  - [--no-passthrough](#--no-passthrough)
27  - [-x](#-x)
28- [ANSI ESCAPE SEQUENCES AND OVERSTRIKES](#ansi-escape-sequences-and-overstrikes)
29- [PASSTHROUGH MODE](#passthrough-mode)
30- [CYGWIN/MSYS/MSYS2 NOTES](#cygwinmsysmsys2-notes)
31- [ENVIRONMENT](#environment)
32
33<!-- END doctoc generated TOC please keep comment here to allow auto update -->
34
35# NAME
36
37vimpager - pager using vim and less.vim
38
39# SYNOPSIS
40
41vimpager [options] 'some file'
42
43&#35; or (this won't always syntax highlight as well)
44
45cat 'some file' | vimpager [options]
46
47For vimcat see [here](markdown/vimcat.md) or 'man vimcat'.
48
49# RUN-TIME DEPENDENCIES
50
51* vim, version >= 7.3
52* a POSIX conformant shell, see [the
53  standard](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html)
54  common variants are searched for, bash is fine
55
56# BUILD DEPENDENCIES
57
58* sharutils or some uuencode (only if you change the */*.vim sources)
59* pandoc (for man pages and html, optional)
60* doctoc (for markdown TOCs, optional)
61* bats (for tests, optional, get it from:
62  https://github.com/sstephenson/bats.git)
63
64# INSTALL
65
66On Ubuntu or Debian, use the following to install a package:
67
68```bash
69git clone git://github.com/rkitover/vimpager
70cd vimpager
71sudo make install-deb
72```
73
74To just build the '.deb' use `make build-deb` instead.
75
76Otherwise use 'make install':
77
78```bash
79git clone git://github.com/rkitover/vimpager
80cd vimpager
81sudo make install
82```
83
84The following make settings are supported at `make install` time:
85
86| **Variable** | **Purpose**                                         |
87|--------------|-----------------------------------------------------|
88| DESTDIR      | base dir where files will be written, for packaging |
89| PREFIX       | install prefix to configure for, e.g. /usr/local    |
90| prefix       | prefix for writing files, e.g. for GNU stow         |
91| POSIX_SHELL  | POSIX shell to use to run the scripts               |
92
93**NOTE:** you should `make clean` before modifying these make settings, as the
94'install' make target does not account for their change.
95
96If you got vimpager from the vim.org scripts section, just put it
97somewhere in your PATH, e.g.:
98
99```bash
100cp vimpager ~/bin
101chmod +x ~/bin/vimpager
102```
103
104In your ~/.bashrc add the following:
105
106```bash
107export PAGER=/usr/local/bin/vimpager
108alias less=$PAGER
109alias zless=$PAGER
110```
111
112# PATHOGEN INSTALLATION
113
114```bash
115cd ~/.vim/bundle
116git clone https://github.com/rkitover/vimpager.git
117```
118
119If you installed using one of the above methods, you can add the runtime to your
120`runtimepath` by putting the following in your `.vimrc`:
121
122```vim
123set rtp^=/usr/share/vimpager
124```
125
126Set `PAGER` and aliases as above with the path into `~/.vim/bundle/vimpager`.
127
128See [Using From Vim](#using-from-vim).
129
130# DESCRIPTION
131
132A PAGER using less.vim with support for highlighting of man pages and
133many other features. Works on most UNIX-like systems as well as Cygwin
134and MSYS.
135
136On GitHub: <http://github.com/rkitover/vimpager>
137
138To use a different vimrc with vimpager, put your settings into a ~/.vimpagerrc
139or ~/.vim/vimpagerrc or a file pointed to by the VIMPAGER_RC environment
140variable.
141
142You can also have a global config file for all users in /etc/vimpagerrc, it will
143be used if the user does not have a `.vimrc` or `.vimpagerrc`.
144
145These are the keys for paging while in vimpager, they are the same as in
146less for the most part:
147
148| **Key** | **Action**              | **Key** | **Action**                |
149|---------|-------------------------|---------|---------------------------|
150|Space    |One page forward         |b        |One page backward          |
151|d        |Half a page forward      |u        |Half a page backward       |
152|Enter    |One line forward         |k        |One line backward          |
153|G        |End of file              |g        |Start of file              |
154|N%       |percentage in file       |,h       |Display this help          |
155|/pattern |Search forward           |?pattern |Search backward            |
156|n        |next match               |N        |Previous match             |
157|`:n`     |next file                |`:N`     |Previous file              |
158|ESC-u    |toggle search highlight  |         |                           |
159|q        |Quit                     |,v       |Toggle Less Mode           |
160
161The commands that start with `,` will use your value of `g:mapleader` if you set
162one instead.
163
164To disable loading plugins, put "set noloadplugins" into a vimpagerrc
165file.
166
167You can also switch on `exists('g:vimpager.enabled')` in your vimrc to set
168alternate settings for vimpager.
169
170**WARNING:** Option names have changed from the previous releases to use a
171dict, if you use the old option names and check on `exists('g:vimpager')`
172everything will work the same way, if you use the new option names you must
173check `exists('g:vimpager.enabled')` instead.
174
175**NOTE:** Before setting the vimpager and less.vim related options described
176below, make sure the `g:vimpager` and `g:less` dicts exist like so:
177
178```vim
179if !exists('g:vimpager')
180  let g:vimpager = {}
181endif
182
183if !exists('g:less')
184  let g:less     = {}
185endif
186```
187
188If you want to disable less compatibility mode, and use regular vim
189motion commands, put this into your .vimrc/vimpagerrc:
190
191```vim
192let g:less.enabled = 0
193```
194
195You can still enable less mode with this setting by pressing ",v". If you
196define `g:mapleader` then it will be the value of `g:mapleader` plus `v`
197instead of `,v`.
198
199Put the following into your .vimrc/vimpagerrc if you want to use gvim/MacVim
200for your pager window:
201
202```vim
203let g:vimpager.gvim = 1
204```
205
206To turn off the feature of passing through text that is smaller than the
207terminal height use this:
208
209```vim
210let g:vimpager.passthrough = 0
211```
212
213See "PASSTHROUGH MODE" further down.
214
215To turn on line numbers set:
216
217```vim
218let g:less.number = 1
219```
220
221they are turned off by default. You can also invoke vimpager with the `-N`
222option to turn on line numbers.
223
224To turn off search highlighting set:
225
226```vim
227let g:less.hlsearch = 0
228```
229
230this can always be toggled with `ESC-u`.
231
232To start vim with -X (no x11 connection, a bit faster startup) put the following
233into your .vimrc/vimpagerrc:
234
235```vim
236let g:vimpager.X11 = 0
237```
238
239**NOTE:** this may disable clipboard integration in X terminals.
240
241The scroll offset (:help scrolloff), may be specified by placing the
242following into your .vimrc/vimpagerrc (default = 5, disable = 0):
243
244```vim
245let g:less.scrolloff = 5
246```
247
248The default is 5 only in less mode, with less mode disabled the default
249is the user's scrolloff setting.
250
251The process tree of vimpager is available in `vimpager.ptree`, an example usage
252is as follows:
253
254```vim
255if exists('g:vimpager.enabled')
256  if exists('g:vimpager.ptree') && g:vimpager.ptree[-2] == 'wman'
257    set ft=man
258  endif
259endif
260```
261
262To disable the use of AnsiEsc.vim to display ANSI colors in the source,
263set:
264
265```vim
266let g:vimpager.ansiesc = 0
267```
268
269see the section [ANSI ESCAPE SEQUENCES AND
270OVERSTRIKES](#ansi-escape-sequences-and-overstrikes) for more details.
271
272You can also set your own function for the message on the statusline via
273`g:less.statusfunc`, see `autoload/vimpager_utils.vim` for the default one as an
274example.
275
276# USING FROM VIM
277
278If you installed vimpager via [Pathogen](#pathogen-installation) or added it to
279your `runtimepath`, then the `Page` command is available from normal vim
280sessions, and it is also available when invoking the vimpager script.
281
282If your global `keywordprg` is set to `man` or `:Man`, which is the default, the
283plugin will reset it to `:Page!\ -t\ man` to page man pages in a new tab. See
284the example below for how to set this for other file types.
285
286You may want to add something like the following to your `.vimrc` to enable the
287mapping to turn on less mode:
288
289```vim
290let g:mapleader = ','
291runtime macros/less.vim
292```
293
294Then `,v` will toggle less mode in any buffer. The default `mapleader` is `\`.
295
296**NOTE:** If you are using Vim 7.3 or earlier, the Surround plugin will conflict
297with less.vim mappings such as Ctrl-D, on 7.4+ this is not an issue as the
298`<nowait>` tag is used for mappings.
299
300The syntax of the `Page` command is:
301
302| **Command** | **Option**       | **Arg**        | **Action**                          |
303|-------------|------------------|----------------|-------------------------------------|
304| Page        | -t, -v, -w or -b | file_path      | open file in less mode              |
305| Page!       | -t, -v, -w or -b | shell_command  | open output of command in less mode |
306| Page        |                  |                | toggle less mode for current file   |
307| Page!       |                  |                | turn on less mode for current file  |
308
309The option switch is optional and determines where the file or command is
310opened:
311
312| **Option** | **Target**           |
313|------------|----------------------|
314| -t         | new tab              |
315| -v         | vertical split       |
316| -w         | new window           |
317| -b         | new buffer (default) |
318
319The default is to open a new buffer.
320
321For `Page!` commands, STDERR is suppressed.
322
323I recommend adding `set hidden` to your `.vimrc`.
324
325If the command is one of `man`, `perldoc`, `pydoc` or `ri` it will be handled
326specially, overstrikes will be removed and `filetype` will be set to `man` or
327`perldoc`.
328
329Ansi escapes will be handled with `AnsiEsc` if available, or removed otherwise.
330See [here](#ansi-escape-sequences-and-overstrikes) for details. The
331`g:vimpager.ansiesc` setting applies to the `Page` command if set.
332
333Here is an example (that is already enabled in the plugin) of how you can use
334this command to look up the python documentation for the module under the cursor
335in a new tab:
336
337```vim
338autocmd FileType python setlocal keywordprg=:Page!\ -t\ pydoc
339```
340
341Then pressing `K` on a module name under the cursor will open the pydoc for it
342in a new tab.
343
344This is done by default in the plugin now for python, ruby, perl and sh (bash
345help.) The global default is man.
346
347# COMMAND LINE OPTIONS
348
349## -h | --help | --usage
350
351Print summary of options.
352
353## -v | --version
354
355Print the version information.
356
357## + | +G
358
359Start at the end of the file, just like less.
360
361## +F
362
363Follow file, like `tail -f` or `less +F`, equivalent to pressing `F` in less
364mode.
365
366## -N | --LINE-NUMBERS
367
368Turn on line numbers, this can also be set with `let g:less.number = 1` .
369
370## -c cmd
371
372Run a vim command after opening the file. Multiple -c arguments are
373supported.
374
375## --cmd cmd
376
377Run a vim command when entering vim before anything else. Multiple --cmd
378arguments are supported.
379
380## -u vimrc
381
382Use alternate .vimrc or .vimpagerrc.
383
384## -s
385
386Squeeze blank lines into a single blank line. GNU man passes this option to
387/usr/bin/pager.
388
389## --passthrough
390
391If files fit on the screen, print them with syntax highlighting using vimcat
392instead of invoking the pager.
393
394## --force-passthrough
395
396Always print files with syntax highlighting to the terminal instead of invoking
397the pager, regardless of whether they fit on the screen.
398
399## --no-passthrough
400
401Never print files with syntax highlighting to the terminal with vimcat, always
402invoke the pager.
403
404## -x
405
406Enable debugging output for the shell script part of vimpager.
407
408# ANSI ESCAPE SEQUENCES AND OVERSTRIKES
409
410If your source is using ANSI escape codes, the AnsiEsc plugin will be
411used to show them, rather than the normal vim highlighting, however read
412the caveats below. If this is not possible, they will be stripped out
413and normal vim highlighting will be used instead.
414
415Overstrikes in man pages, perl, python or ruby docs will always be removed.
416
417vimpager bundles the
418[AnsiEsc](http://www.vim.org/scripts/script.php?script_id=4979)
419plugin (it is expanded at runtime,
420there is nothing you have to do to enable it.)
421
422However, your vim must have been compiled with the 'conceal' feature
423enabled. To check, try
424
425```vim
426:echo has('conceal')
427```
428
429if the result is '1' you have conceal, if it's '0' you do not, and the
430AnsiEsc plugin will not be enabled.
431
432If you're on a Mac, the system vim does not enable this feature, install
433vim from Homebrew.
434
435To disable the use of AnsiEsc.vim, set:
436
437```vim
438let g:vimpager.ansiesc = 0
439```
440
441If the file has a modeline that sets ft or syntax, the setting will override
442the use of AnsiEsc.
443
444To turn off AnsiEsc while viewing a file, simply run
445
446```vim
447:AnsiEsc
448```
449
450To turn off AnsiEsc on the commandline, use an invocation such as the following:
451
452```sh
453vimpager -c 'set ft=&ft' somefile
454```
455
456**NOTE:** The `conceal` feature of vim is still very buggy, especially as
457concerns spacing, and the line wrapping in files highlighted with `AnsiEsc`
458will not be correct (they are wrapped too soon.) The tab stops will be correct
459however, this is fixed up with a vim script.
460
461**NOTE:** `AnsiEsc` is a work in progress, and will only display files with
462simple ANSI codes correctly, such as that output by git tools. More complex
463highlighting is likely not going to work right now. We are working on this.
464
465# PASSTHROUGH MODE
466
467If the text sent to the pager is smaller than the terminal window, then
468it will be displayed without vim as text. If it has ansi codes, they
469will be preserved, otherwise the text will be highlighted with vimcat.
470
471You can turn this off by using:
472
473```vim
474let g:vimpager.passthrough = 0
475```
476
477# CYGWIN/MSYS/MSYS2 NOTES
478
479vimpager works correctly with the native Windows gvim, just put it in
480your PATH and set the vimpager_use_gvim option as described above.
481
482# ENVIRONMENT
483
484`VIMPAGER_VIM` can be set to the vim binary you want to use, if it starts with
485gvim or mvim then gui mode will be used. Will fall back to `EDITOR` if it
486contains vim.
487
488You can specify the vimrc to use with the `VIMPAGER_RC` environment variable.
489
490Setting `VIMPAGER_DEBUG` to a non-zero value will disable suppressing vim
491errors on startup and when switching to the next file.
492