Mercurial > vim
comparison runtime/doc/various.txt @ 15:631143ac4a01 v7.0007
updated for version 7.0007
author | vimboss |
---|---|
date | Sat, 10 Jul 2004 09:47:34 +0000 |
parents | 946da5994c01 |
children | f1d2a58883b9 |
comparison
equal
deleted
inserted
replaced
14:946da5994c01 | 15:631143ac4a01 |
---|---|
1 *various.txt* For Vim version 7.0aa. Last change: 2004 Jun 18 | 1 *various.txt* For Vim version 7.0aa. Last change: 2004 Jul 05 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
7 Various commands *various* | 7 Various commands *various* |
8 | 8 |
9 1. Various commands |various-cmds| | 9 1. Various commands |various-cmds| |
10 2. Online help |online-help| | 10 2. Online help |online-help| |
11 3. Printing |printing| | 11 3. Using Vim like less or more |less| |
12 4. Using Vim like less or more |less| | |
13 | 12 |
14 ============================================================================== | 13 ============================================================================== |
15 1. Various commands *various-cmds* | 14 1. Various commands *various-cmds* |
16 | 15 |
17 *CTRL-L* | 16 *CTRL-L* |
720 Report this to Bram, so that he can add a link on www.vim.org. | 719 Report this to Bram, so that he can add a link on www.vim.org. |
721 - Use the |:helptags| command to generate the tags files. It will find all | 720 - Use the |:helptags| command to generate the tags files. It will find all |
722 languages in the specified directory. | 721 languages in the specified directory. |
723 | 722 |
724 ============================================================================== | 723 ============================================================================== |
725 3. Printing *printing* | |
726 | |
727 On MS-Windows Vim can print your text on any installed printer. On other | |
728 systems a PostScript file is produced. This can be directly sent to a | |
729 PostScript printer. For other printers a program like ghostscript needs to be | |
730 used. | |
731 | |
732 3.1 PostScript Printing |postscript-printing| | |
733 3.2 PostScript Printing Encoding |postscript-print-encoding| | |
734 3.3 PostScript Printing Troubleshooting |postscript-print-trouble| | |
735 3.4 PostScript Utilities |postscript-print-util| | |
736 3.5 Formfeed Characters |printing-formfeed| | |
737 | |
738 {not in Vi} | |
739 {only available when compiled with |+printer| feature} | |
740 | |
741 *:ha* *:hardcopy* *E237* *E238* *E324* | |
742 :[range]ha[rdcopy][!] [arguments] | |
743 Send [range] lines (default whole file) to the | |
744 printer. | |
745 | |
746 On MS-Windows a dialog is displayed to allow selection | |
747 of printer, paper size etc. To skip the dialog, use | |
748 the [!]. In this case the printer defined by | |
749 'printdevice' is used, or, if 'printdevice' is empty, | |
750 the system default printer. | |
751 | |
752 For systems other than MS-Windows, PostScript is | |
753 written in a temp file and 'printexpr' is used to | |
754 actually print it. Then [arguments] can be used by | |
755 'printexpr' through |v:cmdarg|. Otherwise [arguments] | |
756 is ignored. 'printoptions' can be used to specify | |
757 paper size, duplex, etc. | |
758 | |
759 :[range]ha[rdcopy][!] >{filename} | |
760 As above, but write the resulting PostScript in file | |
761 {filename}. | |
762 Things like "%" are expanded |cmdline-special| | |
763 Careful: An existing file is silently overwritten. | |
764 {only available when compiled with the |+postscript| | |
765 feature} | |
766 On MS-Windows use the "print to file" feature of the | |
767 printer driver. | |
768 | |
769 Progress is displayed during printing as a page number and a percentage. To | |
770 abort printing use the interrupt key (CTRL-C or, on MS-systems, CTRL-Break). | |
771 | |
772 Printer output is controlled by the 'printfont' and 'printoptions' options. | |
773 'printheader' specifies the format of a page header. | |
774 | |
775 The printed file is always limited to the selected margins, irrespective of | |
776 the current window's 'wrap' or 'linebreak' settings. The "wrap" item in | |
777 'printoptions' can be used to switch wrapping off. | |
778 The current highlighting colors are used in the printout, with the following | |
779 considerations: | |
780 1) The normal background is always rendered as white (i.e. blank paper.) | |
781 2) White text or the default foreground is rendered as black, so that it shows | |
782 up! | |
783 3) If 'background' is "dark", then the colours are darkened to compensate for | |
784 the fact that otherwise they would be too bright to show up clearly on | |
785 white paper. | |
786 | |
787 | |
788 3.1 PostScript Printing *postscript-printing* | |
789 *E455* *E456* *E457* *E624* | |
790 Provided you have enough disk space there should be no problems generating a | |
791 PostScript file. You need to have the runtime files correctly installed (if | |
792 you can find the help files, they probably are). | |
793 | |
794 There are currently a number of limitations with PostScript printing: | |
795 | |
796 - 'printfont' - The font name is ignored (the Courier family is always used - | |
797 it should be available on all PostScript printers) but the font size is | |
798 used. | |
799 | |
800 - 'printoptions' - The duplex setting is used when generating PostScript | |
801 output, but it is up to the printer to take notice of the setting. If the | |
802 printer does not support duplex printing then it should be silently ignored. | |
803 Some printers, however, don't print at all. | |
804 | |
805 - 8-bit support - While a number of 8-bit print character encodings are | |
806 supported it is possible that some characters will not print. Whether a | |
807 character will print depends on the font in the printer knowing the | |
808 character. Missing characters will be replaced with an upside down question | |
809 mark, or a space if that character is also not known by the font. It may be | |
810 possible to get all the characters in an encoding to print by installing a | |
811 new version of the Courier font family. | |
812 | |
813 - Multi-byte support - Currently VIM will try to convert multi-byte characters | |
814 to the 8-bit encoding specified by 'printencoding' (or latin1 if it is | |
815 empty). Any characters that are not successfully converted are shown as | |
816 unknown characters. Printing will fail if VIM cannot convert the multi-byte | |
817 to the 8-bit encoding. | |
818 | |
819 | |
820 3.2 Custom 8-bit Print Character Encodings *postscript-print-encoding* | |
821 *E618* *E619* | |
822 To use your own print character encoding when printing 8-bit character data | |
823 you need to define your own PostScript font encoding vector. Details on how | |
824 to to define a font encoding vector is beyond the scope of this help file, but | |
825 you can find details in the PostScript Language Reference Manual, 3rd Edition, | |
826 published by Addison-Wesley and available in PDF form at | |
827 http://www.adobe.com/. The following describes what you need to do for VIM to | |
828 locate and use your print character encoding. | |
829 | |
830 i. Decide on a unique name for your encoding vector, one that does not clash | |
831 with any of the recognized or standard encoding names that VIM uses (see | |
832 |encoding-names| for a list), and that no one else is likely to use. | |
833 ii. Copy $VIMRUNTIME/print/latin1.ps to the print subdirectory in your | |
834 'runtimepath' and rename it with your unique name. | |
835 iii. Edit your renamed copy of latin1.ps, replacing all occurrences of latin1 | |
836 with your unique name (don't forget the line starting %%Title:), and | |
837 modify the array of glyph names to define your new encoding vector. The | |
838 array must have exactly 256 entries or you will not be able to print! | |
839 iv. Within VIM, set 'printencoding' to your unique encoding name and then | |
840 print your file. VIM will now use your custom print character encoding. | |
841 | |
842 VIM will report an error with the resource file if you change the order or | |
843 content of the first 3 lines, other than the name of the encoding on the line | |
844 starting %%Title: or the version number on the line starting %%Version:. | |
845 | |
846 [Technical explanation for those that know PostScript - VIM looks for a file | |
847 with the same name as the encoding it will use when printing. The file | |
848 defines a new PostScript Encoding resource called /VIM-name, where name is the | |
849 print character encoding VIM will use.] | |
850 | |
851 | |
852 3.3 PostScript Printing Troubleshooting *postscript-print-trouble* | |
853 *E621* | |
854 Usually the only sign of a problem when printing with PostScript is that your | |
855 printout does not appear. If you are lucky you may get a printed page that | |
856 tells you the PostScript operator that generated the error that prevented the | |
857 print job completing. | |
858 | |
859 There are a number of possible causes as to why the printing may have failed: | |
860 | |
861 - Wrong version of the prolog resource file. The prolog resource file | |
862 contains some PostScript that VIM needs to be able to print. Each version | |
863 of VIM needs one particular version. Make sure you have correctly installed | |
864 the runtime files, and don't have any old versions of a file called prolog | |
865 in the print directory in your 'runtimepath' directory. | |
866 | |
867 - Paper size. Some PostScript printers will abort printing a file if they do | |
868 not support the requested paper size. By default VIM uses A4 paper. Find | |
869 out what size paper your printer normally uses and set the appropriate paper | |
870 size with 'printoptions'. If you cannot find the name of the paper used, | |
871 measure a sheet and compare it with the table of supported paper sizes listed | |
872 for 'printoptions', using the paper that is closest in both width AND height. | |
873 Note: The dimensions of actual paper may vary slightly from the ones listed. | |
874 If there is no paper listed close enough, then you may want to try psresize | |
875 from PSUtils, discussed below. | |
876 | |
877 - Two-sided printing (duplex). Normally a PostScript printer that does not | |
878 support two-sided printing will ignore any request to do it. However, some | |
879 printers may abort the job altogether. Try printing with duplex turned off. | |
880 Note: Duplex prints can be achieved manually using PS utils - see below. | |
881 | |
882 - Collated printing. As with Duplex printing, most PostScript printers that | |
883 do not support collating printouts will ignore a request to do so. Some may | |
884 not. Try printing with collation turned off. | |
885 | |
886 - Syntax highlighting. Some print management code may prevent the generated | |
887 PostScript file from being printed on a black and white printer when syntax | |
888 highlighting is turned on, even if solid black is the only color used. Try | |
889 printing with syntax highlighting turned off. | |
890 | |
891 A safe printoptions setting to try is: > | |
892 | |
893 :set printoptions=paper:A4,duplex:off,collate:n,syntax:n | |
894 | |
895 Replace "A4" with the paper size that best matches your printer paper. | |
896 | |
897 | |
898 3.4 PostScript Utilities *postscript-print-util* | |
899 | |
900 3.4.1 Ghostscript | |
901 | |
902 Ghostscript is a PostScript and PDF interpreter that can be used to display | |
903 and print on non-PostScript printers PostScript and PDF files. It can also | |
904 generate PDF files from PostScript. | |
905 | |
906 Ghostscript will run on a wide variety of platforms. | |
907 | |
908 There are three available versions: | |
909 | |
910 - AFPL Ghostscript (formerly Aladdin Ghostscript) which is free for | |
911 non-commercial use. It can be obtained from: | |
912 | |
913 http://www.cs.wisc.edu/~ghost/ | |
914 | |
915 - GNU Ghostscript which is available under the GNU General Public License. It | |
916 can be obtained from: | |
917 | |
918 ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/gnu/ | |
919 | |
920 - A commercial version for inclusion in commercial products. | |
921 | |
922 Additional information on Ghostscript can also be found at: | |
923 | |
924 http://www.ghostscript.com/ | |
925 | |
926 Support for a number of non PostScript printers is provided in the | |
927 distribution as standard, but if you cannot find support for your printer | |
928 check the Ghostscript site for other printers not included by default. | |
929 | |
930 | |
931 3.4.2 Ghostscript Previewers. | |
932 | |
933 The interface to Ghostscript is very primitive so a number of graphical front | |
934 ends have been created. These allow easier PostScript file selection, | |
935 previewing at different zoom levels, and printing. Check supplied | |
936 documentation for full details. | |
937 | |
938 X11 | |
939 | |
940 - Ghostview. Obtainable from: | |
941 | |
942 http://www.cs.wisc.edu/~ghost/gv/ | |
943 | |
944 - gv. Derived from Ghostview. Obtainable from: | |
945 | |
946 http://wwwthep.physik.uni-mainz.de/~plass/gv/ | |
947 | |
948 Copies (possibly not the most recent) can be found at: | |
949 | |
950 http://www.cs.wisc.edu/~ghost/gv/ | |
951 | |
952 OpenVMS | |
953 | |
954 - Is apparently supported in the main code now (untested). See: | |
955 | |
956 http://wwwthep.physik.uni-mainz.de/~plass/gv/ | |
957 | |
958 Windows and OS/2 | |
959 | |
960 - GSview. Obtainable from: | |
961 | |
962 http://www.cs.wisc.edu/~ghost/gsview/ | |
963 | |
964 DOS | |
965 | |
966 - ps_view. Obtainable from: | |
967 | |
968 ftp://ftp.pg.gda.pl/pub/TeX/support/ps_view/ | |
969 ftp://ftp.dante.de/tex-archive/support/ps_view/ | |
970 | |
971 Linux | |
972 | |
973 - GSview. Linux version of the popular Windows and OS/2 previewer. | |
974 Obtainable from: | |
975 | |
976 http://www.cs.wisc.edu/~ghost/gsview/ | |
977 | |
978 - BMV. Different from Ghostview and gv in that it doesn't use X but svgalib. | |
979 Obtainable from: | |
980 | |
981 ftp://sunsite.unc.edu/pub/Linux/apps/graphics/viewers/svga/bmv-1.2.tgz | |
982 | |
983 | |
984 3.4.3 PSUtils | |
985 | |
986 PSUtils is a collection of utility programs for manipulating PostScript | |
987 documents. Binary distributions are available for many platforms, as well as | |
988 the full source. PSUtils can be found at: | |
989 | |
990 http://knackered.org/angus/psutils | |
991 | |
992 The utilities of interest include: | |
993 | |
994 - psnup. Convert PS files for N-up printing. | |
995 - psselect. Select page range and order of printing. | |
996 - psresize. Change the page size. | |
997 - psbook. Reorder and lay out pages ready for making a book. | |
998 | |
999 The output of one program can be used as the input to the next, allowing for | |
1000 complex print document creation. | |
1001 | |
1002 | |
1003 N-UP PRINTING | |
1004 | |
1005 The psnup utility takes an existing PostScript file generated from VIM and | |
1006 convert it to an n-up version. The simplest way to create a 2-up printout is | |
1007 to first create a PostScript file with: > | |
1008 | |
1009 :hardcopy > test.ps | |
1010 | |
1011 Then on your command line execute: > | |
1012 | |
1013 psnup -n 2 test.ps final.ps | |
1014 | |
1015 Note: You may get warnings from some Ghostscript previewers for files produced | |
1016 by psnup - these may safely be ignored. | |
1017 | |
1018 Finally print the file final.ps to your PostScript printer with your | |
1019 platform's print command. (You will need to delete the two PostScript files | |
1020 afterwards yourself.) 'printexpr' could be modified to perform this extra | |
1021 step before printing. | |
1022 | |
1023 | |
1024 ALTERNATE DUPLEX PRINTING | |
1025 | |
1026 It is possible to achieve a poor man's version of duplex printing using the PS | |
1027 utility psselect. This utility has options -e and -o for printing just the | |
1028 even or odd pages of a PS file respectively. | |
1029 | |
1030 First generate a PS file with the 'hardcopy' command, then generate a new | |
1031 files with all the odd and even numbered pages with: > | |
1032 | |
1033 psselect -o test.ps odd.ps | |
1034 psselect -e test.ps even.ps | |
1035 | |
1036 Next print odd.ps with your platform's normal print command. Then take the | |
1037 print output, turn it over and place it back in the paper feeder. Now print | |
1038 even.ps with your platform's print command. All the even pages should now | |
1039 appear on the back of the odd pages. | |
1040 | |
1041 There a couple of points to bear in mind: | |
1042 | |
1043 1. Position of the first page. If the first page is on top of the printout | |
1044 when printing the odd pages then you need to reverse the order that the odd | |
1045 pages are printed. This can be done with the -r option to psselect. This | |
1046 will ensure page 2 is printed on the back of page 1. | |
1047 Note: it is better to reverse the odd numbered pages rather than the even | |
1048 numbered in case there are an odd number of pages in the original PS file. | |
1049 | |
1050 2. Paper flipping. When turning over the paper with the odd pages printed on | |
1051 them you may have to either flip them horizontally (along the long edge) or | |
1052 vertically (along the short edge), as well as possibly rotating them 180 | |
1053 degrees. All this depends on the printer - it will be more obvious for | |
1054 desktop ink jets than for small office laser printers where the paper path | |
1055 is hidden from view. | |
1056 | |
1057 | |
1058 3.5 Formfeed Characters *printing-formfeed* | |
1059 | |
1060 By default VIM does not do any special processing of |formfeed| control | |
1061 characters. Setting the 'printoptions' formfeed item will make VIM recognize | |
1062 formfeed characters and continue printing the current line at the beginning | |
1063 of the first line on a new page. The use of formfeed characters provides | |
1064 rudimentary print control but there are certain things to be aware of. | |
1065 | |
1066 VIM will always start printing a line (including a line number if enabled) | |
1067 containing a formfeed character, even if it is the first character on the | |
1068 line. This means if a line starting with a formfeed character is the first | |
1069 line of a page then VIM will print a blank page. | |
1070 | |
1071 Since the line number is printed at the start of printing the line containing | |
1072 the formfeed character, the remainder of the line printed on the new page | |
1073 will not have a line number printed for it (in the same way as the wrapped | |
1074 lines of a long line when wrap in 'printoptions' is enabled). | |
1075 | |
1076 If the formfeed character is the last character on a line, then printing will | |
1077 continue on the second line of the new page, not the first. This is due to | |
1078 VIM processing the end of the line after the formfeed character and moving | |
1079 down a line to continue printing. | |
1080 | |
1081 Due to the points made above it is recommended that when formfeed character | |
1082 processing is enabled, printing of line numbers is disabled, and that form | |
1083 feed characters are not the last character on a line. Even then you may need | |
1084 to adjust the number of lines before a formfeed character to prevent | |
1085 accidental blank pages. | |
1086 | |
1087 ============================================================================== | |
1088 4. Using Vim like less or more *less* | 724 4. Using Vim like less or more *less* |
1089 | 725 |
1090 If you use the less or more program to view a file, you don't get syntax | 726 If you use the less or more program to view a file, you don't get syntax |
1091 highlighting. Thus you would like to use Vim instead. You can do this by | 727 highlighting. Thus you would like to use Vim instead. You can do this by |
1092 using the shell script "$VIMRUNTIME/macros/less.sh". | 728 using the shell script "$VIMRUNTIME/macros/less.sh". |