On 22/12/11 22:10, Eric Weir wrote:

On Dec 22, 2011, at 12:29 PM, Tony Mechelynck wrote:

No plugin necessary. See

        :help :hardcopy
        :help popt-option

Margin setting is included. Not sure about wrapping by words; but you can 
reformat the text prior to printing, in order to make sure that your lines 
don't exceed your the width between your print margins.


Thanks, Tony. Actually, I do have a little experience with that. From what I 
can tell from the help, you can setting wrapping, but it appears to be at 
characters. And on a Mac, which I have, the default and only font is courier.

I've never had occasion to reset line width in the past. [I've been picking up 
files in TextEdit and printing from there.] If I can do that and print without 
having to save I imagine that would work. If I have to save to get the new 
setting to take effect in the print, it might be more trouble than it's worth. 
[I'd have to go back and reset line width to my normal setting, which is to 
wrap by word at the screen.

------------------------------------------------------------------------------------------
Eric Weir
[email protected]

"Human coexistence and social life constitute the good common to us all
from which and thanks to which all cultural and social goods derive."

- Zygmunt Bauman



You can set line width (or the following reformatting will use 80 characters if the width is not set) by means of the 'textwidth' option

        :set tw=60

...reformat... (for instance for a plain *.txt file)

        gggqG

...print (after setting 'printoptions' etc. as you want them)

        :set penc=latin1 pfn& pheader&
        :set popt=left:1in,right:1in,top:1in,bottom:1in
        :set popt+=header:2,syntax:n,number:n,wrap:n
        :set popt+=duplex:off,collate:y,jobsplit:n,portrait:y
        :set popt+=paper:A4,formfeed:y
        :hardcopy

...and undo the reformatting which was done before printing.

        u

All the :set commands may of course happen in advance (e.g. in your vimrc) if you don't need to change the values. I'm showing all details of 'printoptions' but if set once and for all in your vimrc you may of course omit the sub-options whose defaults are OK for you.

A 'textwidth' of 60 is typical for 8"-wide paper (A4 is about 8ΒΌ"), 10 cpi (or 7.2pt character width, which, depending on the font family, may correspond to 10pt height or so), and 1" margin on either side.

Vim can center lines, or justify left (default) or right, but, alas, not both. For that you need either a word processor (and a .doc, .odt or similar document, which is not "text" that Vim can edit), or a browser (and an HTML document, optionally with a CSS style sheet, both of which you may create in Vim if you know the syntax). <span class="nostalgy">Ah, where are the times of PC-Write (for IBM PC-DOS 2 or higher) which could do justification or even, on a 9- or 19-needle dot-matrix printer, proportional printing and microjustification, all with a text document? Gone with the snows of yesteryear, AFAICT!</span>

See
        :help :set
        :help 'tw'
        :help gg
        :help gq
        :help G
        :help penc-option
        :help pfn-option
        :help pheader-option
        :help popt-option
        :help :hardcopy
        :help u


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
252. You vote for foreign officials.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to