updated for version 7.0007

This commit is contained in:
Bram Moolenaar
2004-07-10 09:47:34 +00:00
parent 325b7a2fb5
commit 8299df966a
54 changed files with 3573 additions and 2586 deletions

View File

@ -1,4 +1,4 @@
*various.txt* For Vim version 7.0aa. Last change: 2004 Jun 18
*various.txt* For Vim version 7.0aa. Last change: 2004 Jul 05
VIM REFERENCE MANUAL by Bram Moolenaar
@ -8,8 +8,7 @@ Various commands *various*
1. Various commands |various-cmds|
2. Online help |online-help|
3. Printing |printing|
4. Using Vim like less or more |less|
3. Using Vim like less or more |less|
==============================================================================
1. Various commands *various-cmds*
@ -721,369 +720,6 @@ Hints for translators:
- Use the |:helptags| command to generate the tags files. It will find all
languages in the specified directory.
==============================================================================
3. Printing *printing*
On MS-Windows Vim can print your text on any installed printer. On other
systems a PostScript file is produced. This can be directly sent to a
PostScript printer. For other printers a program like ghostscript needs to be
used.
3.1 PostScript Printing |postscript-printing|
3.2 PostScript Printing Encoding |postscript-print-encoding|
3.3 PostScript Printing Troubleshooting |postscript-print-trouble|
3.4 PostScript Utilities |postscript-print-util|
3.5 Formfeed Characters |printing-formfeed|
{not in Vi}
{only available when compiled with |+printer| feature}
*:ha* *:hardcopy* *E237* *E238* *E324*
:[range]ha[rdcopy][!] [arguments]
Send [range] lines (default whole file) to the
printer.
On MS-Windows a dialog is displayed to allow selection
of printer, paper size etc. To skip the dialog, use
the [!]. In this case the printer defined by
'printdevice' is used, or, if 'printdevice' is empty,
the system default printer.
For systems other than MS-Windows, PostScript is
written in a temp file and 'printexpr' is used to
actually print it. Then [arguments] can be used by
'printexpr' through |v:cmdarg|. Otherwise [arguments]
is ignored. 'printoptions' can be used to specify
paper size, duplex, etc.
:[range]ha[rdcopy][!] >{filename}
As above, but write the resulting PostScript in file
{filename}.
Things like "%" are expanded |cmdline-special|
Careful: An existing file is silently overwritten.
{only available when compiled with the |+postscript|
feature}
On MS-Windows use the "print to file" feature of the
printer driver.
Progress is displayed during printing as a page number and a percentage. To
abort printing use the interrupt key (CTRL-C or, on MS-systems, CTRL-Break).
Printer output is controlled by the 'printfont' and 'printoptions' options.
'printheader' specifies the format of a page header.
The printed file is always limited to the selected margins, irrespective of
the current window's 'wrap' or 'linebreak' settings. The "wrap" item in
'printoptions' can be used to switch wrapping off.
The current highlighting colors are used in the printout, with the following
considerations:
1) The normal background is always rendered as white (i.e. blank paper.)
2) White text or the default foreground is rendered as black, so that it shows
up!
3) If 'background' is "dark", then the colours are darkened to compensate for
the fact that otherwise they would be too bright to show up clearly on
white paper.
3.1 PostScript Printing *postscript-printing*
*E455* *E456* *E457* *E624*
Provided you have enough disk space there should be no problems generating a
PostScript file. You need to have the runtime files correctly installed (if
you can find the help files, they probably are).
There are currently a number of limitations with PostScript printing:
- 'printfont' - The font name is ignored (the Courier family is always used -
it should be available on all PostScript printers) but the font size is
used.
- 'printoptions' - The duplex setting is used when generating PostScript
output, but it is up to the printer to take notice of the setting. If the
printer does not support duplex printing then it should be silently ignored.
Some printers, however, don't print at all.
- 8-bit support - While a number of 8-bit print character encodings are
supported it is possible that some characters will not print. Whether a
character will print depends on the font in the printer knowing the
character. Missing characters will be replaced with an upside down question
mark, or a space if that character is also not known by the font. It may be
possible to get all the characters in an encoding to print by installing a
new version of the Courier font family.
- Multi-byte support - Currently VIM will try to convert multi-byte characters
to the 8-bit encoding specified by 'printencoding' (or latin1 if it is
empty). Any characters that are not successfully converted are shown as
unknown characters. Printing will fail if VIM cannot convert the multi-byte
to the 8-bit encoding.
3.2 Custom 8-bit Print Character Encodings *postscript-print-encoding*
*E618* *E619*
To use your own print character encoding when printing 8-bit character data
you need to define your own PostScript font encoding vector. Details on how
to to define a font encoding vector is beyond the scope of this help file, but
you can find details in the PostScript Language Reference Manual, 3rd Edition,
published by Addison-Wesley and available in PDF form at
http://www.adobe.com/. The following describes what you need to do for VIM to
locate and use your print character encoding.
i. Decide on a unique name for your encoding vector, one that does not clash
with any of the recognized or standard encoding names that VIM uses (see
|encoding-names| for a list), and that no one else is likely to use.
ii. Copy $VIMRUNTIME/print/latin1.ps to the print subdirectory in your
'runtimepath' and rename it with your unique name.
iii. Edit your renamed copy of latin1.ps, replacing all occurrences of latin1
with your unique name (don't forget the line starting %%Title:), and
modify the array of glyph names to define your new encoding vector. The
array must have exactly 256 entries or you will not be able to print!
iv. Within VIM, set 'printencoding' to your unique encoding name and then
print your file. VIM will now use your custom print character encoding.
VIM will report an error with the resource file if you change the order or
content of the first 3 lines, other than the name of the encoding on the line
starting %%Title: or the version number on the line starting %%Version:.
[Technical explanation for those that know PostScript - VIM looks for a file
with the same name as the encoding it will use when printing. The file
defines a new PostScript Encoding resource called /VIM-name, where name is the
print character encoding VIM will use.]
3.3 PostScript Printing Troubleshooting *postscript-print-trouble*
*E621*
Usually the only sign of a problem when printing with PostScript is that your
printout does not appear. If you are lucky you may get a printed page that
tells you the PostScript operator that generated the error that prevented the
print job completing.
There are a number of possible causes as to why the printing may have failed:
- Wrong version of the prolog resource file. The prolog resource file
contains some PostScript that VIM needs to be able to print. Each version
of VIM needs one particular version. Make sure you have correctly installed
the runtime files, and don't have any old versions of a file called prolog
in the print directory in your 'runtimepath' directory.
- Paper size. Some PostScript printers will abort printing a file if they do
not support the requested paper size. By default VIM uses A4 paper. Find
out what size paper your printer normally uses and set the appropriate paper
size with 'printoptions'. If you cannot find the name of the paper used,
measure a sheet and compare it with the table of supported paper sizes listed
for 'printoptions', using the paper that is closest in both width AND height.
Note: The dimensions of actual paper may vary slightly from the ones listed.
If there is no paper listed close enough, then you may want to try psresize
from PSUtils, discussed below.
- Two-sided printing (duplex). Normally a PostScript printer that does not
support two-sided printing will ignore any request to do it. However, some
printers may abort the job altogether. Try printing with duplex turned off.
Note: Duplex prints can be achieved manually using PS utils - see below.
- Collated printing. As with Duplex printing, most PostScript printers that
do not support collating printouts will ignore a request to do so. Some may
not. Try printing with collation turned off.
- Syntax highlighting. Some print management code may prevent the generated
PostScript file from being printed on a black and white printer when syntax
highlighting is turned on, even if solid black is the only color used. Try
printing with syntax highlighting turned off.
A safe printoptions setting to try is: >
:set printoptions=paper:A4,duplex:off,collate:n,syntax:n
Replace "A4" with the paper size that best matches your printer paper.
3.4 PostScript Utilities *postscript-print-util*
3.4.1 Ghostscript
Ghostscript is a PostScript and PDF interpreter that can be used to display
and print on non-PostScript printers PostScript and PDF files. It can also
generate PDF files from PostScript.
Ghostscript will run on a wide variety of platforms.
There are three available versions:
- AFPL Ghostscript (formerly Aladdin Ghostscript) which is free for
non-commercial use. It can be obtained from:
http://www.cs.wisc.edu/~ghost/
- GNU Ghostscript which is available under the GNU General Public License. It
can be obtained from:
ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/gnu/
- A commercial version for inclusion in commercial products.
Additional information on Ghostscript can also be found at:
http://www.ghostscript.com/
Support for a number of non PostScript printers is provided in the
distribution as standard, but if you cannot find support for your printer
check the Ghostscript site for other printers not included by default.
3.4.2 Ghostscript Previewers.
The interface to Ghostscript is very primitive so a number of graphical front
ends have been created. These allow easier PostScript file selection,
previewing at different zoom levels, and printing. Check supplied
documentation for full details.
X11
- Ghostview. Obtainable from:
http://www.cs.wisc.edu/~ghost/gv/
- gv. Derived from Ghostview. Obtainable from:
http://wwwthep.physik.uni-mainz.de/~plass/gv/
Copies (possibly not the most recent) can be found at:
http://www.cs.wisc.edu/~ghost/gv/
OpenVMS
- Is apparently supported in the main code now (untested). See:
http://wwwthep.physik.uni-mainz.de/~plass/gv/
Windows and OS/2
- GSview. Obtainable from:
http://www.cs.wisc.edu/~ghost/gsview/
DOS
- ps_view. Obtainable from:
ftp://ftp.pg.gda.pl/pub/TeX/support/ps_view/
ftp://ftp.dante.de/tex-archive/support/ps_view/
Linux
- GSview. Linux version of the popular Windows and OS/2 previewer.
Obtainable from:
http://www.cs.wisc.edu/~ghost/gsview/
- BMV. Different from Ghostview and gv in that it doesn't use X but svgalib.
Obtainable from:
ftp://sunsite.unc.edu/pub/Linux/apps/graphics/viewers/svga/bmv-1.2.tgz
3.4.3 PSUtils
PSUtils is a collection of utility programs for manipulating PostScript
documents. Binary distributions are available for many platforms, as well as
the full source. PSUtils can be found at:
http://knackered.org/angus/psutils
The utilities of interest include:
- psnup. Convert PS files for N-up printing.
- psselect. Select page range and order of printing.
- psresize. Change the page size.
- psbook. Reorder and lay out pages ready for making a book.
The output of one program can be used as the input to the next, allowing for
complex print document creation.
N-UP PRINTING
The psnup utility takes an existing PostScript file generated from VIM and
convert it to an n-up version. The simplest way to create a 2-up printout is
to first create a PostScript file with: >
:hardcopy > test.ps
Then on your command line execute: >
psnup -n 2 test.ps final.ps
Note: You may get warnings from some Ghostscript previewers for files produced
by psnup - these may safely be ignored.
Finally print the file final.ps to your PostScript printer with your
platform's print command. (You will need to delete the two PostScript files
afterwards yourself.) 'printexpr' could be modified to perform this extra
step before printing.
ALTERNATE DUPLEX PRINTING
It is possible to achieve a poor man's version of duplex printing using the PS
utility psselect. This utility has options -e and -o for printing just the
even or odd pages of a PS file respectively.
First generate a PS file with the 'hardcopy' command, then generate a new
files with all the odd and even numbered pages with: >
psselect -o test.ps odd.ps
psselect -e test.ps even.ps
Next print odd.ps with your platform's normal print command. Then take the
print output, turn it over and place it back in the paper feeder. Now print
even.ps with your platform's print command. All the even pages should now
appear on the back of the odd pages.
There a couple of points to bear in mind:
1. Position of the first page. If the first page is on top of the printout
when printing the odd pages then you need to reverse the order that the odd
pages are printed. This can be done with the -r option to psselect. This
will ensure page 2 is printed on the back of page 1.
Note: it is better to reverse the odd numbered pages rather than the even
numbered in case there are an odd number of pages in the original PS file.
2. Paper flipping. When turning over the paper with the odd pages printed on
them you may have to either flip them horizontally (along the long edge) or
vertically (along the short edge), as well as possibly rotating them 180
degrees. All this depends on the printer - it will be more obvious for
desktop ink jets than for small office laser printers where the paper path
is hidden from view.
3.5 Formfeed Characters *printing-formfeed*
By default VIM does not do any special processing of |formfeed| control
characters. Setting the 'printoptions' formfeed item will make VIM recognize
formfeed characters and continue printing the current line at the beginning
of the first line on a new page. The use of formfeed characters provides
rudimentary print control but there are certain things to be aware of.
VIM will always start printing a line (including a line number if enabled)
containing a formfeed character, even if it is the first character on the
line. This means if a line starting with a formfeed character is the first
line of a page then VIM will print a blank page.
Since the line number is printed at the start of printing the line containing
the formfeed character, the remainder of the line printed on the new page
will not have a line number printed for it (in the same way as the wrapped
lines of a long line when wrap in 'printoptions' is enabled).
If the formfeed character is the last character on a line, then printing will
continue on the second line of the new page, not the first. This is due to
VIM processing the end of the line after the formfeed character and moving
down a line to continue printing.
Due to the points made above it is recommended that when formfeed character
processing is enabled, printing of line numbers is disabled, and that form
feed characters are not the last character on a line. Even then you may need
to adjust the number of lines before a formfeed character to prevent
accidental blank pages.
==============================================================================
4. Using Vim like less or more *less*