Edit Page
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 12: | Line 12: | ||
|category2= |
|category2= |
||
}} |
}} |
||
− | To get this to work you have to know how many lines per page :hardcopy is normally making. Open empty document and in Normal mode "100o". Then make ":%s/^/\=line('.')". Now ":hardcopy |
+ | To get this to work you have to know how many lines per page :hardcopy is normally making. Open empty document and in Normal mode "100o". Then make ":%s/^/\=line('.')". Now ":hardcopy > nu.ps". Open nu.ps in PostScript viewer. You will see how many lines per page Vim is printing. |
In my case this is 73. Now set the 'printheader' option: |
In my case this is 73. Now set the 'printheader' option: |
||
− | :set printheader=% |
+ | :set printheader=%<%f%h%m%=Page\ %N\ of\ %{line('$')/73+1} |
<pre> |
<pre> |
||
Line 40: | Line 40: | ||
endif |
endif |
||
endfunction |
endfunction |
||
− | set printheader =% |
+ | set printheader =%<%f%h%m%=Page\ %N\ of\ %{PH_Multiple()} |
</pre> |
</pre> |
||
Line 46: | Line 46: | ||
Some nice additions from comp.editors: |
Some nice additions from comp.editors: |
||
− | :set printheader=% |
+ | :set printheader=%<%f%h%m%=Page\ %N\ of\ %{line('$')/73+(line('$')%73!=0)} |
− | :set printheader=% |
+ | :set printheader=%<%f%h%m%=Page\ %N\ of\ %{(line('$')-1)/73+1} |
---- |
---- |
||
− | Clever; however there are multiple settings (see e.g. 'printfont' & 'printoptions') which can change the number of lines per page. Also, if long lines wrap when printed (the default), then the number of lines in the buffer may not match the number of lines printed. |
+ | Clever; however there are multiple settings (see e.g. 'printfont' & 'printoptions') which can change the number of lines per page. Also, if long lines wrap when printed (the default), then the number of lines in the buffer may not match the number of lines printed. |
---- |
---- |
||
A simpler way to do the page count arithmetic: |
A simpler way to do the page count arithmetic: |
||
− | :set printheader=% |
+ | :set printheader=%<%f%h%m=Page\ %N\ of %{(line('$')+72)/73} |